private static XYDatasetMinMax createDeltaDataset( String name, SortedMap<TimeAxisKey, DiffStat> aggregatedDiffstats) { TimeSeriesCollection dataset = new TimeSeriesCollection(); int minimum = 0; int maximum = 0; TimeSeries addedSeries = new TimeSeries(name); TimeSeries removedSeries = new TimeSeries(name); for (Entry<TimeAxisKey, DiffStat> entry : aggregatedDiffstats.entrySet()) { TimeAxisKey timeAxisKey = entry.getKey(); DiffStat diffStat = entry.getValue(); RegularTimePeriod period = timeAxisKey.toPeriod(); int added = diffStat.added(); maximum = max(maximum, added); addedSeries.add(period, Integer.valueOf(added)); int removed = -diffStat.removed(); minimum = min(minimum, removed); removedSeries.add(period, Integer.valueOf(removed)); } dataset.addSeries(addedSeries); dataset.addSeries(removedSeries); return new XYDatasetMinMax(dataset, minimum, maximum); }
private static XYDatasetAndTotal createTotalDataset( String name, SortedMap<TimeAxisKey, DiffStat> aggregatedDiffstats) { int total = 0; TimeSeries totalSeries = new TimeSeries(name); for (Entry<TimeAxisKey, DiffStat> entry : aggregatedDiffstats.entrySet()) { TimeAxisKey timeAxisKey = entry.getKey(); DiffStat diffStat = entry.getValue(); RegularTimePeriod period = timeAxisKey.toPeriod(); total += diffStat.delta(); totalSeries.add(period, Integer.valueOf(total)); } TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(totalSeries); return new XYDatasetAndTotal(dataset, total); }
public PathChangeModel getPath(String path) { if (stat == null) { return null; } return stat.getPath(path); }