EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.scriptbuilder.domain]

COVERAGE SUMMARY FOR SOURCE FILE [InterpretableStatement.java]

nameclass, %method, %block, %line, %
InterpretableStatement.java100% (1/1)83%  (5/6)73%  (57/78)75%  (15/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InterpretableStatement100% (1/1)83%  (5/6)73%  (57/78)75%  (15/20)
toString (): String 0%   (0/1)0%   (0/13)0%   (0/1)
equals (Object): boolean 100% (1/1)72%  (21/29)60%  (6/10)
InterpretableStatement (String []): void 100% (1/1)100% (9/9)100% (3/3)
functionDependencies (OsFamily): Iterable 100% (1/1)100% (2/2)100% (1/1)
hashCode (): int 100% (1/1)100% (14/14)100% (4/4)
render (OsFamily): String 100% (1/1)100% (11/11)100% (1/1)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.scriptbuilder.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Arrays;
24 
25import org.jclouds.scriptbuilder.util.Utils;
26 
27import com.google.common.base.Joiner;
28import com.google.common.collect.ImmutableList;
29 
30/**
31 * Statement used in a shell script
32 * 
33 * @author Adrian Cole
34 */
35public class InterpretableStatement implements Statement {
36 
37   private String[] statements;
38 
39   public InterpretableStatement(String... statements) {
40      this.statements = checkNotNull(statements, "statements");
41   }
42 
43   public String render(OsFamily family) {
44      return Utils
45               .replaceTokens(Joiner.on(ShellToken.LF.to(family)).join(statements), ShellToken.tokenValueMap(family));
46   }
47 
48   @Override
49   public Iterable<String> functionDependencies(OsFamily family) {
50      return ImmutableList.of();
51   }
52 
53   @Override
54   public int hashCode() {
55      final int prime = 31;
56      int result = 1;
57      result = prime * result + Arrays.hashCode(statements);
58      return result;
59   }
60 
61   @Override
62   public boolean equals(Object obj) {
63      if (this == obj)
64         return true;
65      if (obj == null)
66         return false;
67      if (getClass() != obj.getClass())
68         return false;
69      InterpretableStatement other = (InterpretableStatement) obj;
70      if (!Arrays.equals(statements, other.statements))
71         return false;
72      return true;
73   }
74 
75   @Override
76   public String toString() {
77      return "[statements=" + Arrays.toString(statements) + "]";
78   }
79}

[all classes][org.jclouds.scriptbuilder.domain]
EMMA 2.0.5312 (C) Vladimir Roubtsov