EMMA Coverage Report (generated Wed Jun 22 19:47:49 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)76%  (59/78)80%  (16/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InterpretableStatement100% (1/1)83%  (5/6)76%  (59/78)80%  (16/20)
toString (): String 0%   (0/1)0%   (0/13)0%   (0/1)
equals (Object): boolean 100% (1/1)79%  (23/29)70%  (7/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 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
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