@Test public void testLongAverage() { Average avg = new Average(); avg.add(2L); avg.add(4L); avg.add(4L); Assert.assertEquals(3L, avg.toLong()); }
public void add(Long input) { count++; final long longAvgUntilNow = toLong(); setLongValue(toLong() + ((input + longRemainder - longAvgUntilNow) / count)); longRemainder = (input + longRemainder - longAvgUntilNow) % count; }
Average extends AbstractRollupStat { public void add(Long input) { count++; final long longAvgUntilNow = toLong(); setLongValue(toLong() + ((input + longRemainder - longAvgUntilNow) / count)); longRemainder = (input + longRemainder - longAvgUntilNow) % count; } }
Average extends AbstractRollupStat { public void add(Long input) { count++; final long longAvgUntilNow = toLong(); setLongValue(toLong() + ((input + longRemainder - longAvgUntilNow) / count)); longRemainder = (input + longRemainder - longAvgUntilNow) % count; } Average(); @SuppressWarnings("unused") // used by Jackson  Average(long value); @SuppressWarnings("unused") // used by Jackson  Average(double value);  Average(int count, Object value); }
Average extends AbstractRollupStat { public void add(Long input) { count++; final long longAvgUntilNow = toLong(); setLongValue(toLong() + ((input + longRemainder - longAvgUntilNow) / count)); longRemainder = (input + longRemainder - longAvgUntilNow) % count; } Average(); @SuppressWarnings("unused") // used by Jackson  Average(long value); @SuppressWarnings("unused") // used by Jackson  Average(double value);  Average(int count, Object value); void add(Long input); void addBatch(Long input, long dataPoints); void add(Double input); void addBatch(Double input, long dataPoints); @Override byte getStatType(); }
Average extends AbstractRollupStat { public void add(Long input) { count++; final long longAvgUntilNow = toLong(); setLongValue(toLong() + ((input + longRemainder - longAvgUntilNow) / count)); longRemainder = (input + longRemainder - longAvgUntilNow) % count; } Average(); @SuppressWarnings("unused") // used by Jackson  Average(long value); @SuppressWarnings("unused") // used by Jackson  Average(double value);  Average(int count, Object value); void add(Long input); void addBatch(Long input, long dataPoints); void add(Double input); void addBatch(Double input, long dataPoints); @Override byte getStatType();  }