AggregatingTrimmer implements SlidingWindowTrimmer<Long> { public AggregatingTrimmer(final long startTime, final TimeUnit startUnitTime, final long chunkTimeSize, final TimeUnit chunkTimeSizeUnit) { this.startTime = startTime; this.startUnitTime = startUnitTime; this.chunkSize = TimeUnit.NANOSECONDS.convert(chunkTimeSize, chunkTimeSizeUnit) << COLLISION_BUFFER_POWER; } AggregatingTrimmer(final long startTime,
                              final TimeUnit startUnitTime,
                              final long chunkTimeSize,
                              final TimeUnit chunkTimeSizeUnit); @Override void trim(final ConcurrentNavigableMap<Long, Long> map, final long key); void register(final TimeReservoir<AggregatedValueObject> timeReservoirListener); @Override void setTimeReservoir(final TimeReservoir<Long> timeReservoirNotifier); TimeReservoir<Long> getTimeReservoirNotifier();  }
@Test public void testAggregatingTrimmer() { time10nsReservoir.update(10L, startTime(), startUnitTime); time10nsReservoir.update(20L, startTime() + 50, startUnitTime); checkInNanos(time10nsReservoir, startTime() + 50, 1, 20, 20, 20); checkInNanos(aggregatedTime100nsReservoir, startTime() + 100, 2, 10, 20, 15); }