1 37 package net.sourceforge.cruisecontrol; 38 39 import java.io.Serializable ; 40 import java.util.Collections ; 41 import java.util.Iterator ; 42 import java.util.List ; 43 44 45 public final class BuildInfoSummary implements Serializable { 46 private static final long serialVersionUID = 994064080136410358L; 47 48 private final List buildInfoList; 49 private final int numBrokenBuilds; 50 private final int numSuccessfulBuilds; 51 52 public BuildInfoSummary(List buildInfoList) { 53 this.buildInfoList = Collections.unmodifiableList(buildInfoList); 54 int brokenBuildsCounter = 0; 55 int successfulBuildsCounter = 0; 56 for (Iterator i = buildInfoList.iterator(); i.hasNext();) { 57 BuildInfo buildInfo = (BuildInfo) i.next(); 58 if (buildInfo.isSuccessful()) { 59 successfulBuildsCounter++; 60 } else { 61 brokenBuildsCounter++; 62 } 63 } 64 numBrokenBuilds = brokenBuildsCounter; 65 numSuccessfulBuilds = successfulBuildsCounter; 66 } 67 68 69 70 73 public List getBuildInfoList() { 74 return buildInfoList; 75 } 76 79 public int getNumBrokenBuilds() { 80 return numBrokenBuilds; 81 } 82 85 public int getNumSuccessfulBuilds() { 86 return numSuccessfulBuilds; 87 } 88 89 public Iterator iterator() { 90 return buildInfoList.iterator(); 91 } 92 93 public int size() { 94 return buildInfoList.size(); 95 } 96 97 98 99 public BuildInfo[] asArray() { 100 return (BuildInfo[]) buildInfoList.toArray(new BuildInfo[buildInfoList.size()]); 101 } 102 } | Popular Tags |