@Test(expected = NullPointerException.class) public void counterRollupBuilderWithNullRollupInputThrowsException() throws IOException { Points<BluefloodCounterRollup> combined = new Points<BluefloodCounterRollup>(); combined.add(new Points.Point<BluefloodCounterRollup>(1234L, null)); BluefloodCounterRollup rollup = BluefloodCounterRollup.buildRollupFromCounterRollups(combined); }
public static BluefloodCounterRollup buildRollupFromCounterRollups(Points<BluefloodCounterRollup> input) throws IOException { Number count = 0L; double seconds = 0; int sampleCount = 0; for (Points.Point<BluefloodCounterRollup> point : input.getPoints().values()) { count = sum(count, point.getData().getCount()); sampleCount = sampleCount + point.getData().getSampleCount(); seconds += Util.safeDiv(point.getData().getCount().doubleValue(), point.getData().getRate()); } double aggregateRate = Util.safeDiv(count.doubleValue(), seconds); return new BluefloodCounterRollup().withCount(count).withRate(aggregateRate).withSampleCount(sampleCount); }
BluefloodCounterRollup implements Rollup { public static BluefloodCounterRollup buildRollupFromCounterRollups(Points<BluefloodCounterRollup> input) throws IOException { Number count = 0L; double seconds = 0; int sampleCount = 0; for (Points.Point<BluefloodCounterRollup> point : input.getPoints().values()) { count = sum(count, point.getData().getCount()); sampleCount = sampleCount + point.getData().getSampleCount(); seconds += Util.safeDiv(point.getData().getCount().doubleValue(), point.getData().getRate()); } double aggregateRate = Util.safeDiv(count.doubleValue(), seconds); return new BluefloodCounterRollup().withCount(count).withRate(aggregateRate).withSampleCount(sampleCount); } }
BluefloodCounterRollup implements Rollup { public static BluefloodCounterRollup buildRollupFromCounterRollups(Points<BluefloodCounterRollup> input) throws IOException { Number count = 0L; double seconds = 0; int sampleCount = 0; for (Points.Point<BluefloodCounterRollup> point : input.getPoints().values()) { count = sum(count, point.getData().getCount()); sampleCount = sampleCount + point.getData().getSampleCount(); seconds += Util.safeDiv(point.getData().getCount().doubleValue(), point.getData().getRate()); } double aggregateRate = Util.safeDiv(count.doubleValue(), seconds); return new BluefloodCounterRollup().withCount(count).withRate(aggregateRate).withSampleCount(sampleCount); } BluefloodCounterRollup(); }
BluefloodCounterRollup implements Rollup { public static BluefloodCounterRollup buildRollupFromCounterRollups(Points<BluefloodCounterRollup> input) throws IOException { Number count = 0L; double seconds = 0; int sampleCount = 0; for (Points.Point<BluefloodCounterRollup> point : input.getPoints().values()) { count = sum(count, point.getData().getCount()); sampleCount = sampleCount + point.getData().getSampleCount(); seconds += Util.safeDiv(point.getData().getCount().doubleValue(), point.getData().getRate()); } double aggregateRate = Util.safeDiv(count.doubleValue(), seconds); return new BluefloodCounterRollup().withCount(count).withRate(aggregateRate).withSampleCount(sampleCount); } BluefloodCounterRollup(); BluefloodCounterRollup withCount(Number count); BluefloodCounterRollup withRate(double rate); BluefloodCounterRollup withSampleCount(int sampleCount); Number getCount(); double getRate(); int getSampleCount(); @Override String toString(); @Override boolean equals(Object obj); static BluefloodCounterRollup buildRollupFromRawSamples(Points<SimpleNumber> input); static BluefloodCounterRollup buildRollupFromCounterRollups(Points<BluefloodCounterRollup> input); @Override Boolean hasData(); @Override RollupType getRollupType(); }
BluefloodCounterRollup implements Rollup { public static BluefloodCounterRollup buildRollupFromCounterRollups(Points<BluefloodCounterRollup> input) throws IOException { Number count = 0L; double seconds = 0; int sampleCount = 0; for (Points.Point<BluefloodCounterRollup> point : input.getPoints().values()) { count = sum(count, point.getData().getCount()); sampleCount = sampleCount + point.getData().getSampleCount(); seconds += Util.safeDiv(point.getData().getCount().doubleValue(), point.getData().getRate()); } double aggregateRate = Util.safeDiv(count.doubleValue(), seconds); return new BluefloodCounterRollup().withCount(count).withRate(aggregateRate).withSampleCount(sampleCount); } BluefloodCounterRollup(); BluefloodCounterRollup withCount(Number count); BluefloodCounterRollup withRate(double rate); BluefloodCounterRollup withSampleCount(int sampleCount); Number getCount(); double getRate(); int getSampleCount(); @Override String toString(); @Override boolean equals(Object obj); static BluefloodCounterRollup buildRollupFromRawSamples(Points<SimpleNumber> input); static BluefloodCounterRollup buildRollupFromCounterRollups(Points<BluefloodCounterRollup> input); @Override Boolean hasData(); @Override RollupType getRollupType();  }