@Test public void testEmptySum() { MockedTime time = new MockedTime(); EventType type = EventType.COLLAPSED; NumerusRollingNumber counter = new NumerusRollingNumber(EventType.BOOTSTRAP, time, 200, 10); assertEquals(0, counter.getRollingSum(type)); }
public long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return 0; long sum = 0; for (Bucket b : buckets) { sum += b.getAdder(type).sum(); } return sum; }
NumerusRollingNumber { public long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return 0; long sum = 0; for (Bucket b : buckets) { sum += b.getAdder(type).sum(); } return sum; } }
NumerusRollingNumber { public long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return 0; long sum = 0; for (Bucket b : buckets) { sum += b.getAdder(type).sum(); } return sum; } NumerusRollingNumber(NumerusRollingNumberEvent events, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets);   NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, int timeInMilliseconds, int numberOfBuckets); private  NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets); }
NumerusRollingNumber { public long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return 0; long sum = 0; for (Bucket b : buckets) { sum += b.getAdder(type).sum(); } return sum; } NumerusRollingNumber(NumerusRollingNumberEvent events, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets);   NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, int timeInMilliseconds, int numberOfBuckets); private  NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets); void increment(NumerusRollingNumberEvent type, Boolean doNotBlock); void increment(NumerusRollingNumberEvent type); void add(NumerusRollingNumberEvent type, long value); void updateRollingMax(NumerusRollingNumberEvent type, long value); void reset(); long getCumulativeSum(NumerusRollingNumberEvent type); long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock); long getRollingSum(NumerusRollingNumberEvent type); long getValueOfLatestBucket(NumerusRollingNumberEvent type); long[] getValues(NumerusRollingNumberEvent type); long getRollingMaxValue(NumerusRollingNumberEvent type); }
NumerusRollingNumber { public long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock) { Bucket lastBucket = getCurrentBucket(doNotBlock); if (lastBucket == null) return 0; long sum = 0; for (Bucket b : buckets) { sum += b.getAdder(type).sum(); } return sum; } NumerusRollingNumber(NumerusRollingNumberEvent events, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets);   NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, int timeInMilliseconds, int numberOfBuckets); private  NumerusRollingNumber(NumerusRollingNumberEvent events, Time time, NumerusProperty<Integer> timeInMilliseconds, NumerusProperty<Integer> numberOfBuckets); void increment(NumerusRollingNumberEvent type, Boolean doNotBlock); void increment(NumerusRollingNumberEvent type); void add(NumerusRollingNumberEvent type, long value); void updateRollingMax(NumerusRollingNumberEvent type, long value); void reset(); long getCumulativeSum(NumerusRollingNumberEvent type); long getRollingSum(NumerusRollingNumberEvent type, Boolean doNotBlock); long getRollingSum(NumerusRollingNumberEvent type); long getValueOfLatestBucket(NumerusRollingNumberEvent type); long[] getValues(NumerusRollingNumberEvent type); long getRollingMaxValue(NumerusRollingNumberEvent type);  }