private long toAbsolutePosition(short blockId, int position) { return sumPositions.get(blockId) + position; }
@Override public long getLong(int id) { assert id < _idToValueMap.size(); return _idToValueMap.get(id); }
@Test public void testAddAndPrependUpgrade() { LongList list = new CompactableLongArrayList(); long val = Integer.MAX_VALUE + 42L; list.add(42); list.add(0, val); assertThat(list.size(), equalTo(2)); assertThat(list, contains(val, 42L)); assertThat(list.get(0), equalTo(val)); assertThat(list.get(1), equalTo(42L)); }
@Override public long getId() { return ids.get(index); }
private long toAbsolutePosition(short blockId, int position) { return sumPositions.get(blockId) + position; }
private long toAbsolutePosition(short blockId, int position) { return sumPositions.get(blockId) + position; }
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Long get(final int i) { return list.get(i); } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public Long get(final int i) { synchronized (sync) { return list.get(i); } } /**
private static void doSwap(LongList longs, int i, int j) { longs.set(i, longs.set(j, longs.get(i))); } private static void doSwap(DoubleList doubles, int i, int j) {
for(int i = 0; i < frequency; i++) { OutputBitStream obs = indexWriter.newDocumentRecord(); indexWriter.writeDocumentPointer(obs, docPointers.get(i)); indexWriter.writePositionCount(obs, counts.get(i)); indexWriter.writeDocumentPositions(obs, positions.get(i)
for(int i = 0; i < frequency; i++) { OutputBitStream obs = directIndexWriter.newDocumentRecord(); directIndexWriter.writeDocumentPointer(obs, docPointers.get(i)); directIndexWriter.writePositionCount(obs, counts.get(i));
@Test public void onDemandViewTest() { TestRevenoEngine reveno = new TestRevenoEngine(tempDir); reveno.config().mutableModel(); DynamicCommand create = reveno.domain().transaction("create", (tx, ctx) -> { ctx.repo().store(tx.id(Page.class), new Page("test", tx.id(Link.class))); ctx.repo().store(tx.id(Link.class), new Link("tt", "http://g.le")); }).uniqueIdFor(Page.class, Link.class).returnsIdOf(Page.class).command(); reveno.domain().viewMapper(Link.class, LinkView.class, (id,e,r) -> new LinkView(id, e.name, e.url)); reveno.domain().viewMapper(Page.class, PageView.class, (id,e,r) -> new PageView(id, e.name, r.get(LinkView.class, e.linksIds.get(0)))); reveno.startup(); long pageId = reveno.executeSync(create, new HashMap<>()); Assert.assertTrue(pageId != 0); PageView page = reveno.query().find(PageView.class, pageId); Assert.assertEquals(1, page.links.size()); long linkId = page.links.get(0).id; Assert.assertSame(reveno.query().find(LinkView.class, linkId), page.links.get(0)); reveno.shutdown(); }