1 23 24 package org.hammurapi.results.simple; 25 26 import java.util.ArrayList ; 27 import java.util.Collection ; 28 import java.util.Collections ; 29 import java.util.Iterator ; 30 31 import org.hammurapi.WaiverSet; 32 import org.hammurapi.results.AggregatedResults; 33 import org.hammurapi.results.CompositeResults; 34 35 40 public class SimpleCompositeResults extends SimpleDetailedResults implements CompositeResults { 41 44 private static final long serialVersionUID = -2179448002856899900L; 45 private Collection children=new ArrayList (); 46 47 public Collection getChildren() { 48 return Collections.unmodifiableCollection(children); 49 } 50 51 public void add(AggregatedResults child) { 52 aggregate(child); 53 children.add(child); 54 } 55 56 SimpleCompositeResults(String name, WaiverSet waiverSet) { 57 super(name, waiverSet); 58 } 59 60 public int size() { 61 int ret=0; 62 Iterator it=children.iterator(); 63 while (it.hasNext()) { 64 Object child = it.next(); 65 ret++; 66 if (child instanceof CompositeResults) { 67 ret+=((CompositeResults) child).size(); 68 } 69 } 70 return ret; 71 } 72 } 73 | Popular Tags |