Search in sources :

Example 1 with RecordBuffer

use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.

the class TestRecordBuffer method recBufferIterate05.

@Test
public void recBufferIterate05() {
    RecordBuffer rb = make(3, 5);
    Iterator<Record> iter = rb.iterator(intToRecord(1), null);
    same(iter, 2, 4, 6);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 2 with RecordBuffer

use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.

the class TestRecordBuffer method make.

private static RecordBuffer make(int n, int len) {
    RecordBuffer rb = new RecordBuffer(recordFactory, len);
    for (int i = 0; i < n; i++) {
        Record r = RecordLib.intToRecord(2 * i + 2);
        rb.add(r);
    }
    return rb;
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer)

Example 3 with RecordBuffer

use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.

the class TestRecordBuffer method recBuffer10.

@Test(expected = BufferException.class)
public void recBuffer10() {
    RecordBuffer rb = make(4, 5);
    contains(rb, 2, 4, 6, 8);
    rb.shiftUp(4);
}
Also used : RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 4 with RecordBuffer

use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.

the class TestRecordBuffer method recBuffer06.

@Test
public void recBuffer06() {
    RecordBuffer rb = make(4, 5);
    contains(rb, 2, 4, 6, 8);
    rb.shiftDown(2);
    contains(rb, 2, 4, 8);
    rb.shiftUp(2);
    contains(rb, 2, 4, -1, 8);
}
Also used : RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 5 with RecordBuffer

use of org.apache.jena.tdb.base.buffer.RecordBuffer in project jena by apache.

the class TestRecordBuffer method recBufferIterate02.

@Test
public void recBufferIterate02() {
    RecordBuffer rb = make(3, 5);
    Iterator<Record> iter = rb.iterator();
    same(iter, 2, 4, 6);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Aggregations

RecordBuffer (org.apache.jena.tdb.base.buffer.RecordBuffer)34 BaseTest (org.apache.jena.atlas.junit.BaseTest)26 Test (org.junit.Test)26 Record (org.apache.jena.tdb.base.record.Record)14 RecordLib.intToRecord (org.apache.jena.tdb.base.record.RecordLib.intToRecord)11 PtrBuffer (org.apache.jena.tdb.base.buffer.PtrBuffer)3 ByteBuffer (java.nio.ByteBuffer)2 IOException (java.io.IOException)1 RecordBufferPage (org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)1