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

COVERAGE SUMMARY FOR SOURCE FILE [StatementList.java]

nameclass, %method, %block, %line, %
StatementList.java100% (1/1)71%  (5/7)60%  (84/140)50%  (17/34)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StatementList100% (1/1)71%  (5/7)60%  (84/140)50%  (17/34)
equals (Object): boolean 0%   (0/1)0%   (0/37)0%   (0/13)
hashCode (): int 0%   (0/1)0%   (0/19)0%   (0/4)
StatementList (Iterable): void 100% (1/1)100% (10/10)100% (3/3)
StatementList (Statement []): void 100% (1/1)100% (10/10)100% (3/3)
accept (StatementVisitor): void 100% (1/1)100% (16/16)100% (3/3)
functionDependencies (OsFamily): Iterable 100% (1/1)100% (23/23)100% (4/4)
render (OsFamily): String 100% (1/1)100% (25/25)100% (4/4)

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.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, AcceptsStatementVisitor {
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   @Override
88   public void accept(StatementVisitor visitor) {
89      for (Statement statement : statements) {
90         visitor.visit(statement);
91      }
92   }
93}

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