@Test public void shouldResultBeCorrect() { final ModeConsolidator consolidator = new ModeConsolidator(10); consolidator.accumulate(2L, 1); consolidator.accumulate(1L, 2); consolidator.accumulate(4L, 3); consolidator.accumulate(3L, 2); Assert.assertEquals(2, consolidator.consolidateAndReset()); }
@Override public synchronized void accumulate(final long timestamp, final int value) { this.values.add(value); }
ModeConsolidator extends Consolidator { @Override public synchronized void accumulate(final long timestamp, final int value) { this.values.add(value); } }
ModeConsolidator extends Consolidator { @Override public synchronized void accumulate(final long timestamp, final int value) { this.values.add(value); } ModeConsolidator(final int maxSamples); }
ModeConsolidator extends Consolidator { @Override public synchronized void accumulate(final long timestamp, final int value) { this.values.add(value); } ModeConsolidator(final int maxSamples); @Override synchronized void accumulate(final long timestamp, final int value); @Override synchronized int consolidate(); }
ModeConsolidator extends Consolidator { @Override public synchronized void accumulate(final long timestamp, final int value) { this.values.add(value); } ModeConsolidator(final int maxSamples); @Override synchronized void accumulate(final long timestamp, final int value); @Override synchronized int consolidate();  }