Report detailed statistics as a string
String longestOp = longestOp(taskStats.iterator());
boolean first = true;
StringBuffer sb = new StringBuffer();
sb.append(tableTitle(longestOp));
sb.append(newline);
int reported = 0;
Iterator it = taskStats.iterator();
while (it.hasNext()) {
TaskStats stat = (TaskStats) it.next();
if (stat.getElapsed()>=0) { // consider only tasks that ended
if (!first) {
sb.append(newline);
}
first = false;
String line = taskReportLine(longestOp, stat);
reported++;
if (taskStats.size()>2 && reported%2==0) {
line = line.replaceAll(" "," - ");
}
sb.append(line);
}
}
String reptxt = (reported==0 ? "No Matching Entries Were Found!" : sb.toString());
return new Report(reptxt,reported,reported,taskStats.size());