use of org.apache.jena.tdb.index.bplustree.BPTreeRecords in project jena by apache.
the class TestBPTreeRecords method bpt_merge_1.
@Test
public void bpt_merge_1() {
BPTreeRecords bpr1 = make();
BPTreeRecords bpr2 = make();
insert(bpr1, 10, 20);
insert(bpr2, 99);
BPTreeRecords bpr3 = (BPTreeRecords) bpr1.merge(bpr2, null);
contains(bpr1, 10, 20, 99);
contains(bpr2);
assertSame(bpr1, bpr3);
bpr1.release();
bpr2.release();
}
use of org.apache.jena.tdb.index.bplustree.BPTreeRecords in project jena by apache.
the class TestBPTreeRecords method bpt_records_6.
@Test
public void bpt_records_6() {
BPTreeRecords bpr = make();
fill(bpr);
// No match.
assertNull(bpr.internalSearch(RecordLib.intToRecord(0x20)));
Record r = RecordLib.intToRecord(0x32);
Record r2 = search(bpr, r);
assertTrue(Record.keyEQ(r, r2));
r = bpr.getLowRecord();
r2 = search(bpr, r);
assertTrue(Record.keyEQ(r, r2));
r = bpr.getHighRecord();
r2 = search(bpr, r);
assertTrue(Record.keyEQ(r, r2));
bpr.release();
}
use of org.apache.jena.tdb.index.bplustree.BPTreeRecords in project jena by apache.
the class TestBPTreeRecords method bpt_shift_3.
@Test
public void bpt_shift_3() {
BPTreeRecords bpr1 = make();
BPTreeRecords bpr2 = make();
insert(bpr1, 10, 20);
insert(bpr2, 99);
Record r = bpr1.shiftRight(bpr2, null);
assertTrue(r + " != " + RecordLib.intToRecord(10), Record.keyEQ(r, RecordLib.intToRecord(10)));
contains(bpr1, 10);
contains(bpr2, 20, 99);
bpr1.release();
bpr2.release();
}
use of org.apache.jena.tdb.index.bplustree.BPTreeRecords in project jena by apache.
the class TestBPTreeRecords method bpt_shift_4.
@Test
public void bpt_shift_4() {
BPTreeRecords bpr1 = make();
BPTreeRecords bpr2 = make();
insert(bpr1, 10, 20);
insert(bpr2, 5);
Record r = bpr2.shiftLeft(bpr1, null);
assertTrue(Record.keyEQ(r, RecordLib.intToRecord(10)));
contains(bpr1, 20);
contains(bpr2, 5, 10);
bpr1.release();
bpr2.release();
}
use of org.apache.jena.tdb.index.bplustree.BPTreeRecords in project jena by apache.
the class TestBPTreeRecords method bpt_records_5.
@Test
public void bpt_records_5() {
BPTreeRecords bpr = make();
int N = bpr.getMaxSize();
for (int i = bpr.getMaxSize() - 1; i >= 0; i--) insert(bpr, (i + 0x20));
delete(bpr, (1 + 0x20));
assertEquals(N - 1, bpr.getCount());
check(bpr);
delete(bpr, (2 + 0x20));
assertEquals(N - 2, bpr.getCount());
check(bpr);
delete(bpr, bpr.getLowRecord());
assertEquals(N - 3, bpr.getCount());
check(bpr);
bpr.internalDelete(bpr.getHighRecord());
assertEquals(N - 4, bpr.getCount());
check(bpr);
bpr.release();
}
Aggregations