ArrayList<Dot> result = new ArrayList<Dot>();
for (int i = 0; i < Math.min(5, builds.size()); i++) {
Build build = builds.get(i);
if (build.isBuilding()) {
result.add(new Dot(DotColor.GRAY, build.getJob().getCode()));
} else {
switch (build.getResult()) {
case SUCCESS:
result
.add(new Dot(DotColor.GREEN, build.getJob()
.getCode()));
break;
case UNSTABLE:
result.add(new Dot(DotColor.YELLOW, build.getJob()
.getCode()));
break;
case FAILURE:
result.add(new Dot(DotColor.RED, build.getJob().getCode()));
break;
}
}
}
return result;