EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.scriptbuilder.domain]

COVERAGE SUMMARY FOR SOURCE FILE [StatementList.java]

nameclass, %method, %block, %line, %
StatementList.java100% (1/1)86%  (6/7)75%  (95/127)69%  (22/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StatementList100% (1/1)86%  (6/7)75%  (95/127)69%  (22/32)
hashCode (): int 0%   (0/1)0%   (0/19)0%   (0/4)
equals (Object): boolean 100% (1/1)65%  (24/37)54%  (7/13)
StatementList (Iterable): void 100% (1/1)100% (10/10)100% (3/3)
StatementList (Statement []): void 100% (1/1)100% (10/10)100% (3/3)
functionDependencies (OsFamily): Iterable 100% (1/1)100% (23/23)100% (4/4)
getStatements (): List 100% (1/1)100% (3/3)100% (1/1)
render (OsFamily): String 100% (1/1)100% (25/25)100% (4/4)

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.List;
24 
25import com.google.common.collect.ImmutableList;
26import com.google.common.collect.ImmutableList.Builder;
27 
28/**
29 * Statements used in a shell script
30 * 
31 * @author Adrian Cole
32 */
33public class StatementList implements Statement {
34 
35   public final List<Statement> statements;
36 
37   public StatementList(Statement... statements) {
38      this.statements = ImmutableList.copyOf(checkNotNull(statements, "statements"));
39   }
40 
41   public StatementList(Iterable<Statement> statements) {
42      this.statements = ImmutableList.copyOf(checkNotNull(statements, "statements"));
43   }
44 
45   public String render(OsFamily family) {
46      StringBuilder statementsBuilder = new StringBuilder();
47      for (Statement statement : statements) {
48         statementsBuilder.append(statement.render(family));
49      }
50      return statementsBuilder.toString();
51   }
52 
53   @Override
54   public Iterable<String> functionDependencies(OsFamily family) {
55      Builder<String> functions = ImmutableList.<String> builder();
56      for (Statement statement : statements) {
57         functions.addAll(statement.functionDependencies(family));
58      }
59      return functions.build();
60   }
61 
62   @Override
63   public int hashCode() {
64      final int prime = 31;
65      int result = 1;
66      result = prime * result + ((statements == null) ? 0 : statements.hashCode());
67      return result;
68   }
69 
70   @Override
71   public boolean equals(Object obj) {
72      if (this == obj)
73         return true;
74      if (obj == null)
75         return false;
76      if (getClass() != obj.getClass())
77         return false;
78      StatementList other = (StatementList) obj;
79      if (statements == null) {
80         if (other.statements != null)
81            return false;
82      } else if (!statements.equals(other.statements))
83         return false;
84      return true;
85   }
86 
87   public List<Statement> getStatements() {
88      return statements;
89   }
90}

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