@Test public void testFindAndPrevious() throws InterruptedException, DeadlockException, TransactionRolledBackException, IOException { for (int n = 0; n < 100; n++) { loadDisklessDatabase(n); Cursor cursor; TestRecord record; TestKey key; int expected; { expected = n; cursor = map.last(); while ((record = (TestRecord) cursor.previous()) != null) { checkRecord(--expected, record); } assertEquals(0, expected); } { for (int k = 0; k <= n; k++) { { int missingKey = k * GAP - GAP / 2; key = new TestKey(missingKey); record = (TestRecord) map.find(key); assertNull(record); cursor = map.cursor(key); expected = k; while ((record = (TestRecord) cursor.previous()) != null) { checkRecord(--expected, record); } assertEquals(0, expected); } int presentKey = k * GAP; expected = k; key = new TestKey(presentKey); record = (TestRecord) map.find(key); if (k < n) { checkRecord(expected, record); cursor = map.cursor(key); while ((record = (TestRecord) cursor.previous()) != null) { checkRecord(expected--, record); } assertEquals(n == 0 ? 0 : -1, expected); } else { assertEquals(n, k); assertNull(record); } } } } }
public abstract AbstractRecord previous() throws IOException, InterruptedException;
Cursor { public abstract AbstractRecord previous() throws IOException, InterruptedException; }
Cursor { public abstract AbstractRecord previous() throws IOException, InterruptedException;  }
Cursor { public abstract AbstractRecord previous() throws IOException, InterruptedException;  abstract AbstractRecord next(); abstract AbstractRecord previous(); abstract void close(); }
Cursor { public abstract AbstractRecord previous() throws IOException, InterruptedException;  abstract AbstractRecord next(); abstract AbstractRecord previous(); abstract void close();  }