Exemplo n.º 1
0
  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);
  }
Exemplo n.º 2
0
  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);
  }
Exemplo n.º 3
0
 public PathChangeModel getPath(String path) {
   if (stat == null) {
     return null;
   }
   return stat.getPath(path);
 }