Report statistics as a string, aggregate for tasks named the same.
// aggregate by task name
int reported = 0;
LinkedHashMap p2 = new LinkedHashMap();
for (Iterator it = taskStats.iterator(); it.hasNext();) {
TaskStats stat1 = (TaskStats) it.next();
if (stat1.getElapsed()>=0) { // consider only tasks that ended
reported++;
String name = stat1.getTask().getName();
TaskStats stat2 = (TaskStats) p2.get(name);
if (stat2 == null) {
try {
stat2 = (TaskStats) stat1.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
p2.put(name,stat2);
} else {
stat2.add(stat1);
}
}
}
// now generate report from secondary list p2
return genPartialReport(reported, p2, taskStats.size());