@Test public void testAverage() { Assert.assertEquals(2L, BluefloodTimerRollup.avg(longs)); Assert.assertEquals(2.0d, BluefloodTimerRollup.avg(doubles)); Assert.assertEquals(2.0d, BluefloodTimerRollup.avg(mixed)); Assert.assertEquals(2.0d, BluefloodTimerRollup.avg(alsoMixed)); }
public static Number avg(Collection<Number> numbers) { Number sum = BluefloodTimerRollup.sum(numbers); if (sum instanceof Long || sum instanceof Integer) return (Long)sum / numbers.size(); else return (Double)sum / (double)numbers.size(); }
BluefloodTimerRollup implements Rollup, IBaseRollup { public static Number avg(Collection<Number> numbers) { Number sum = BluefloodTimerRollup.sum(numbers); if (sum instanceof Long || sum instanceof Integer) return (Long)sum / numbers.size(); else return (Double)sum / (double)numbers.size(); } }
BluefloodTimerRollup implements Rollup, IBaseRollup { public static Number avg(Collection<Number> numbers) { Number sum = BluefloodTimerRollup.sum(numbers); if (sum instanceof Long || sum instanceof Integer) return (Long)sum / numbers.size(); else return (Double)sum / (double)numbers.size(); } BluefloodTimerRollup(); }
BluefloodTimerRollup implements Rollup, IBaseRollup { public static Number avg(Collection<Number> numbers) { Number sum = BluefloodTimerRollup.sum(numbers); if (sum instanceof Long || sum instanceof Integer) return (Long)sum / numbers.size(); else return (Double)sum / (double)numbers.size(); } BluefloodTimerRollup(); BluefloodTimerRollup withSum(double sum); BluefloodTimerRollup withCount(long count); BluefloodTimerRollup withCountPS(double count_ps); BluefloodTimerRollup withSampleCount(int sampleCount); BluefloodTimerRollup withMinValue(MinValue min); BluefloodTimerRollup withMinValue(Number num); BluefloodTimerRollup withMaxValue(MaxValue max); BluefloodTimerRollup withMaxValue(Number num); BluefloodTimerRollup withAverage(Average average); BluefloodTimerRollup withAverage(Number average); BluefloodTimerRollup withVariance(Variance variance); BluefloodTimerRollup withVariance(Number variance); Average getAverage(); MaxValue getMaxValue(); MinValue getMinValue(); Variance getVariance(); void setPercentile(String label, Number mean); @Override Boolean hasData(); double getRate(); double getSum(); long getCount(); int getSampleCount(); String toString(); @Override RollupType getRollupType(); boolean equals(Object obj); static Number sum(Collection<Number> numbers); static Number avg(Collection<Number> numbers); static Number max(Collection<Number> numbers); static double calculatePerSecond(long countA, double countPerSecA, long countB, double countPerSecB); Map<String, Percentile> getPercentiles(); static BluefloodTimerRollup buildRollupFromTimerRollups(Points<BluefloodTimerRollup> input); }
BluefloodTimerRollup implements Rollup, IBaseRollup { public static Number avg(Collection<Number> numbers) { Number sum = BluefloodTimerRollup.sum(numbers); if (sum instanceof Long || sum instanceof Integer) return (Long)sum / numbers.size(); else return (Double)sum / (double)numbers.size(); } BluefloodTimerRollup(); BluefloodTimerRollup withSum(double sum); BluefloodTimerRollup withCount(long count); BluefloodTimerRollup withCountPS(double count_ps); BluefloodTimerRollup withSampleCount(int sampleCount); BluefloodTimerRollup withMinValue(MinValue min); BluefloodTimerRollup withMinValue(Number num); BluefloodTimerRollup withMaxValue(MaxValue max); BluefloodTimerRollup withMaxValue(Number num); BluefloodTimerRollup withAverage(Average average); BluefloodTimerRollup withAverage(Number average); BluefloodTimerRollup withVariance(Variance variance); BluefloodTimerRollup withVariance(Number variance); Average getAverage(); MaxValue getMaxValue(); MinValue getMinValue(); Variance getVariance(); void setPercentile(String label, Number mean); @Override Boolean hasData(); double getRate(); double getSum(); long getCount(); int getSampleCount(); String toString(); @Override RollupType getRollupType(); boolean equals(Object obj); static Number sum(Collection<Number> numbers); static Number avg(Collection<Number> numbers); static Number max(Collection<Number> numbers); static double calculatePerSecond(long countA, double countPerSecA, long countB, double countPerSecB); Map<String, Percentile> getPercentiles(); static BluefloodTimerRollup buildRollupFromTimerRollups(Points<BluefloodTimerRollup> input);  }