Machine machine = eventReport.getMachines().get(ip);
Map<String, EventType> types = machine.getTypes();
StringBuilder detailBuilder = new StringBuilder();
StringBuilder summaryBuilder = new StringBuilder();
for (Entry<String, EventType> eventEntry : types.entrySet()) {
EventType eventType = eventEntry.getValue();
long[] typeCounts = new long[60];
long[] typeFails = new long[60];
Map<String, EventName> names = eventType.getNames();
for (Entry<String, EventName> nameEntry : names.entrySet()) {
EventName eventName = nameEntry.getValue();
List<Range> ranges = new ArrayList<Range>(eventName.getRanges().values());
detailBuilder.append(eventType.getId());
detailBuilder.append('\t');
detailBuilder.append(eventName.getId());
detailBuilder.append('\t');
long[] totalCount = getTotalCount(ranges);
detailBuilder.append(arrayToString(totalCount));
detailBuilder.append('\t');
long[] failCount = getFailsCount(ranges);
detailBuilder.append(arrayToString(failCount));
detailBuilder.append('\n');
String key = eventType.getId() + "\t" + eventName.getId();
GraphLine detailLine = allDetailCache.get(key);
if (detailLine == null) {
detailLine = new GraphLine();
allDetailCache.put(key, detailLine);
}
detailLine.totalCounts = arrayAdd(detailLine.totalCounts, totalCount);
detailLine.failCounts = arrayAdd(detailLine.failCounts, failCount);
typeCounts = arrayAdd(typeCounts, totalCount);
typeFails = arrayAdd(typeFails, failCount);
}
String summaryKey = eventType.getId();
GraphLine summaryLine = allSummaryCache.get(summaryKey);
if (summaryLine == null) {
summaryLine = new GraphLine();
allSummaryCache.put(summaryKey, summaryLine);
}
summaryLine.totalCounts = arrayAdd(summaryLine.totalCounts, typeCounts);
summaryLine.failCounts = arrayAdd(summaryLine.failCounts, typeFails);
summaryBuilder.append(eventType.getId());
summaryBuilder.append('\t');
summaryBuilder.append(arrayToString(typeCounts));
summaryBuilder.append('\t');
summaryBuilder.append(arrayToString(typeFails));
summaryBuilder.append('\n');