searchBound = TIME_BASED_KEYS.getCounterStartingAt(changeSetMillisUTC - searchTimeDelta);
@Override public Iterator<NodeKey> changedNodesSince( final long timestamp ) { long searchBound = TIME_BASED_KEYS.getCounterStartingAt(timestamp - searchTimeDelta); Collection<JournalRecord> journalRecords = records.tailMap(searchBound, true).values(); if (journalRecords.isEmpty()) {
searchBound = TIME_BASED_KEYS.getCounterStartingAt(changeSetMillisUTC - searchTimeDelta);
@Override public Iterator<NodeKey> changedNodesSince( final long timestamp ) { long searchBound = TIME_BASED_KEYS.getCounterStartingAt(timestamp - searchTimeDelta); Collection<JournalRecord> journalRecords = records.tailMap(searchBound, true).values(); if (journalRecords.isEmpty()) {
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor16Bit() { long maxValue = ((long)Math.pow(2, 16)) - 1; TimeBasedKeys counter = TimeBasedKeys.create(16); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(maxValue, counter.getCounterEndingAt(0L)); }
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor6Bit() { TimeBasedKeys counter = TimeBasedKeys.create(6); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(63L, counter.getCounterEndingAt(0L)); }
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor8Bit() { TimeBasedKeys counter = TimeBasedKeys.create(8); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(255L, counter.getCounterEndingAt(0L)); }
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor2Bit() { TimeBasedKeys counter = TimeBasedKeys.create(2); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(3L, counter.getCounterEndingAt(0L)); }
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor4Bit() { TimeBasedKeys counter = TimeBasedKeys.create(4); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(15L, counter.getCounterEndingAt(0L)); }
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor1BitCounter() { TimeBasedKeys counter = TimeBasedKeys.create(1); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(1L, counter.getCounterEndingAt(0L)); }
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor5Bit() { TimeBasedKeys counter = TimeBasedKeys.create(5); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(31L, counter.getCounterEndingAt(0L)); }
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor3Bit() { TimeBasedKeys counter = TimeBasedKeys.create(3); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(7L, counter.getCounterEndingAt(0L)); }
@Test public void shouldCorrectlyCalculateFirstAndLastCounterFor7Bit() { TimeBasedKeys counter = TimeBasedKeys.create(7); assertEquals(0L, counter.getCounterStartingAt(0L)); assertEquals(127L, counter.getCounterEndingAt(0L)); }