SlidingWindowPolicy implements Serializable { public long floorFrameTs(long timestamp) { return subtractClamped(timestamp, floorMod( (timestamp >= Long.MIN_VALUE + frameOffset ? timestamp : timestamp + frameSize) - frameOffset, frameSize )); } SlidingWindowPolicy(long frameSize, long frameOffset, long framesPerWindow); long frameSize(); long frameOffset(); long windowSize(); boolean isTumbling(); long floorFrameTs(long timestamp); long higherFrameTs(long timestamp); SlidingWindowPolicy withOffset(long offset); SlidingWindowPolicy toTumblingByFrame(); static SlidingWindowPolicy slidingWinPolicy(long windowSize, long slideBy); static SlidingWindowPolicy tumblingWinPolicy(long windowSize);  }
@Test public void when_frameLength3() { definition = new SlidingWindowPolicy(3, 0, 10); assertEquals(Long.MIN_VALUE, definition.floorFrameTs(Long.MIN_VALUE)); }
@Test public void when_floorOutOfRange_then_minValue() { definition = new SlidingWindowPolicy(4, 3, 10); assertEquals(Long.MIN_VALUE, definition.floorFrameTs(Long.MIN_VALUE + 2)); assertEquals(Long.MAX_VALUE, definition.floorFrameTs(Long.MAX_VALUE)); }