Search in sources :

Example 21 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class IndexTestLib method buildIndex.

// ---------- Utilities
// public static RangeIndex buildRangeIndex(RangeIndexMaker maker, int[]
// keys)
// {
// RangeIndex index = maker.make();
// IndexTestLib.add(index, keys);
// return index;
// }
public static Index buildIndex(IndexMaker maker, int[] keys) {
    Index index = maker.makeIndex();
    IndexTestLib.add(index, keys);
    return index;
}
Also used : RangeIndex(org.apache.jena.dboe.index.RangeIndex) Index(org.apache.jena.dboe.index.Index)

Example 22 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class TDB2StorageBuilder method makeTupleIndex.

private TupleIndex makeTupleIndex(String primary, String index, String name) {
    TupleMap cmap = TupleMap.create(primary, index);
    RecordFactory rf = new RecordFactory(SystemTDB.SizeOfNodeId * cmap.length(), 0);
    RangeIndex rIdx = makeRangeIndex(rf, index);
    TupleIndex tIdx = new TupleIndexRecord(primary.length(), cmap, index, rf, rIdx);
    return tIdx;
}
Also used : RecordFactory(org.apache.jena.dboe.base.record.RecordFactory) TupleIndexRecord(org.apache.jena.tdb2.store.tupletable.TupleIndexRecord) RangeIndex(org.apache.jena.dboe.index.RangeIndex) TupleIndex(org.apache.jena.tdb2.store.tupletable.TupleIndex) TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap)

Example 23 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class AbstractTestRangeIndex method tree_iter_0_02.

@Test
public void tree_iter_0_02() {
    int[] keys = { 1, 2, 3, 4, 5 };
    RangeIndex rIndex = makeRangeIndex(5);
    add(rIndex, keys);
    List<Integer> x = toIntList(rIndex.iterator(null, null));
    List<Integer> expected = toIntList(keys);
    assertEquals(expected, x);
}
Also used : RangeIndex(org.apache.jena.dboe.index.RangeIndex) Test(org.junit.Test) IndexTestLib.randTest(org.apache.jena.dboe.index.test.IndexTestLib.randTest)

Example 24 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class AbstractTestRangeIndex method tree_iter_2_05.

@Test
public void tree_iter_2_05() {
    int[] keys = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    RangeIndex rIndex = makeRangeIndex(2);
    add(rIndex, keys);
    List<Integer> x = toIntList(rIndex.iterator(null, r(4)));
    List<Integer> expected = toIntList(0, 1, 2, 3);
    assertEquals(expected, x);
}
Also used : RangeIndex(org.apache.jena.dboe.index.RangeIndex) Test(org.junit.Test) IndexTestLib.randTest(org.apache.jena.dboe.index.test.IndexTestLib.randTest)

Example 25 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class AbstractTestRangeIndex method tree_ins_2_03.

@Test
public void tree_ins_2_03() {
    int[] keys = { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 };
    RangeIndex rIndex = makeRangeIndex(2);
    testInsert(rIndex, keys);
    assertEquals(0, r(rIndex.minKey()));
    assertEquals(9, r(rIndex.maxKey()));
}
Also used : RangeIndex(org.apache.jena.dboe.index.RangeIndex) Test(org.junit.Test) IndexTestLib.randTest(org.apache.jena.dboe.index.test.IndexTestLib.randTest)

Aggregations

RangeIndex (org.apache.jena.dboe.index.RangeIndex)45 IndexTestLib.randTest (org.apache.jena.dboe.index.test.IndexTestLib.randTest)37 Test (org.junit.Test)37 TupleMap (org.apache.jena.atlas.lib.tuple.TupleMap)3 Record (org.apache.jena.dboe.base.record.Record)2 RecordFactory (org.apache.jena.dboe.base.record.RecordFactory)2 IndexParams (org.apache.jena.dboe.index.IndexParams)2 RecordLib.intToRecord (org.apache.jena.dboe.test.RecordLib.intToRecord)2 TupleIndexRecord (org.apache.jena.tdb2.store.tupletable.TupleIndexRecord)2 Index (org.apache.jena.dboe.index.Index)1 BPlusTree (org.apache.jena.dboe.trans.bplustree.BPlusTree)1 TupleIndex (org.apache.jena.tdb2.store.tupletable.TupleIndex)1