String longestOp = longestOp(taskStats.iterator());
boolean first = true;
StringBuffer sb = new StringBuffer();
sb.append(tableTitle(longestOp));
sb.append(newline);
int reported = 0;
for (Iterator it = taskStats.iterator(); it.hasNext();) {
TaskStats stat = (TaskStats) it.next();
if (stat.getElapsed()>=0 && stat.getTask().getName().startsWith(prefix)) { // only ended tasks with proper name
reported++;
if (!first) {
sb.append(newline);
}
first = false;
String line = taskReportLine(longestOp,stat);
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());