Search in sources :

Example 46 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class ExtHashTestBase method delete.

public static ExtHash delete(ExtHash extHash, int... recs) {
    for (int i : recs) {
        Record r = intToRecord(i);
        extHash.delete(r);
    }
    return extHash;
}
Also used : Record(org.apache.jena.tdb.base.record.Record)

Example 47 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class ExtHashTestBase method check.

public static void check(ExtHash extHash, int... recs) {
    extHash.check();
    for (int i : recs) {
        Record r = intToRecordKey(i);
        assertNotNull(extHash.find(r));
    }
    List<Integer> y = unique(asList(recs));
    int x = (int) extHash.size();
    assertEquals(y.size(), x);
}
Also used : Record(org.apache.jena.tdb.base.record.Record)

Example 48 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class AbstractTestIndex method index_find_1.

@Test
public void index_find_1() {
    int[] keys = { 1 };
    Index index = test(keys);
    Record r = intToRecord(1, RecordLib.TestRecordLength);
    r = index.find(r);
    assertNotNull(r);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) Test(org.junit.Test)

Example 49 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class AbstractTestIndex method index_find_2.

@Test
public void index_find_2() {
    int[] keys = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    Index index = test(keys);
    Record r = intToRecord(20, RecordLib.TestRecordLength);
    r = index.find(r);
    assertNull(r);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) Test(org.junit.Test)

Example 50 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class RecordsFromInput method hasNext.

@Override
public boolean hasNext() {
    if (finished)
        return false;
    if (slot != null)
        return true;
    if (idx == -1 || idx == buffer.length) {
        len = fill();
        if (len == -1) {
            finished = true;
            return false;
        }
        idx = 0;
    }
    // Fill one slot.
    Record record = recordFactory.create();
    //        System.out.print("In:  ") ;
    for (int i = 0; i < itemsPerRow; i++) {
        long x = Hex.getLong(buffer, idx);
        idx += 16;
        // Separator or end-of-line.
        idx++;
        int j = (colMap == null) ? i : colMap.mapSlotIdx(i);
        int recordOffset = j * SystemTDB.SizeOfLong;
        Bytes.setLong(x, record.getKey(), recordOffset);
    //            System.out.printf("%016X ", x) ;
    }
    // Buffer all processed. 
    if (idx >= len)
        idx = -1;
    slot = record;
    return true;
}
Also used : Record(org.apache.jena.tdb.base.record.Record)

Aggregations

Record (org.apache.jena.tdb.base.record.Record)95 Test (org.junit.Test)20 RecordLib.intToRecord (org.apache.jena.tdb.base.record.RecordLib.intToRecord)15 RecordBuffer (org.apache.jena.tdb.base.buffer.RecordBuffer)14 BaseTest (org.apache.jena.atlas.junit.BaseTest)10 RangeIndex (org.apache.jena.tdb.index.RangeIndex)8 BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)6 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)6 NoSuchElementException (java.util.NoSuchElementException)5 FileSet (org.apache.jena.tdb.base.file.FileSet)5 BPlusTree (org.apache.jena.tdb.index.bplustree.BPlusTree)5 NodeId (org.apache.jena.tdb.store.NodeId)5 Pair (org.apache.jena.atlas.lib.Pair)4 Location (org.apache.jena.tdb.base.file.Location)4 BPlusTreeParams (org.apache.jena.tdb.index.bplustree.BPlusTreeParams)4 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)3 StorageException (org.apache.jena.tdb.base.StorageException)3 RecordBufferPage (org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)3 ColumnMap (org.apache.jena.tdb.lib.ColumnMap)3 TupleIndexRecord (org.apache.jena.tdb.store.tupletable.TupleIndexRecord)3