@Test public void testMoveHeadIndexByOne() { FixedSizeSlidingWindowMetrics metrics = new FixedSizeSlidingWindowMetrics(3); assertThat(metrics.headIndex).isEqualTo(0); metrics.moveHeadIndexByOne(); assertThat(metrics.headIndex).isEqualTo(1); metrics.moveHeadIndexByOne(); assertThat(metrics.headIndex).isEqualTo(2); metrics.moveHeadIndexByOne(); assertThat(metrics.headIndex).isEqualTo(0); metrics.moveHeadIndexByOne(); assertThat(metrics.headIndex).isEqualTo(1); }
void moveHeadIndexByOne() { this.headIndex = (headIndex + 1) % windowSize; }
FixedSizeSlidingWindowMetrics implements Metrics { void moveHeadIndexByOne() { this.headIndex = (headIndex + 1) % windowSize; } }
FixedSizeSlidingWindowMetrics implements Metrics { void moveHeadIndexByOne() { this.headIndex = (headIndex + 1) % windowSize; } FixedSizeSlidingWindowMetrics(int windowSize); }
FixedSizeSlidingWindowMetrics implements Metrics { void moveHeadIndexByOne() { this.headIndex = (headIndex + 1) % windowSize; } FixedSizeSlidingWindowMetrics(int windowSize); @Override synchronized Snapshot record(long duration, TimeUnit durationUnit, Outcome outcome); synchronized Snapshot getSnapshot(); }
FixedSizeSlidingWindowMetrics implements Metrics { void moveHeadIndexByOne() { this.headIndex = (headIndex + 1) % windowSize; } FixedSizeSlidingWindowMetrics(int windowSize); @Override synchronized Snapshot record(long duration, TimeUnit durationUnit, Outcome outcome); synchronized Snapshot getSnapshot();  }