@Test public void testAll() throws Exception { TestUtils.assertMemoryLeak(() -> { try (LongChain chain = new LongChain(1024 * 1024, Integer.MAX_VALUE)) { final int N = 1000; final int nChains = 10; final Rnd rnd = new Rnd(); final LongList heads = new LongList(nChains); final ObjList<LongList> expectedValues = new ObjList<>(); for (int i = 0; i < nChains; i++) { LongList expected = new LongList(N); heads.add(populateChain(chain, rnd, expected)); expectedValues.add(expected); Assert.assertEquals(N, expected.size()); } Assert.assertEquals(nChains, expectedValues.size()); for (int i = 0; i < nChains; i++) { LongChain.TreeCursor cursor = chain.getCursor(heads.getQuick(i)); LongList expected = expectedValues.get(i); int count = 0; while (cursor.hasNext()) { Assert.assertEquals(expected.getQuick(count), cursor.next()); count++; } Assert.assertEquals(N, count); } } }); }
public TreeCursor getCursor(long tailOffset) { cursor.of(tailOffset); return cursor; }
LongChain implements Closeable, Mutable { public TreeCursor getCursor(long tailOffset) { cursor.of(tailOffset); return cursor; } }
LongChain implements Closeable, Mutable { public TreeCursor getCursor(long tailOffset) { cursor.of(tailOffset); return cursor; } LongChain(long valuePageSize, int valueMaxPages); }
LongChain implements Closeable, Mutable { public TreeCursor getCursor(long tailOffset) { cursor.of(tailOffset); return cursor; } LongChain(long valuePageSize, int valueMaxPages); @Override void clear(); @Override void close(); TreeCursor getCursor(long tailOffset); long put(long value, long parentOffset); }
LongChain implements Closeable, Mutable { public TreeCursor getCursor(long tailOffset) { cursor.of(tailOffset); return cursor; } LongChain(long valuePageSize, int valueMaxPages); @Override void clear(); @Override void close(); TreeCursor getCursor(long tailOffset); long put(long value, long parentOffset);  }