Search in sources :

Example 26 with RecordBuffer

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

the class TestRecordBuffer method recBuffer03.

// Shift at LHS
@Test
public void recBuffer03() {
    RecordBuffer rb = make(4, 5);
    contains(rb, 2, 4, 6, 8);
    rb.shiftUp(0);
    rb.set(0, r(0));
    contains(rb, 0, 2, 4, 6, 8);
    rb.shiftDown(0);
    contains(rb, 2, 4, 6, 8);
}
Also used : RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 27 with RecordBuffer

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

the class TestRecordBuffer method recBufferIterate06.

@Test
public void recBufferIterate06() {
    RecordBuffer rb = make(3, 5);
    Iterator<Record> iter = rb.iterator(null, intToRecord(1));
    same(iter);
}
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 28 with RecordBuffer

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

the class TestRecordBuffer method recBuffer15.

// Remove tests
@Test
public void recBuffer15() {
    RecordBuffer rb = make(5, 5);
    contains(rb, 2, 4, 6, 8, 10);
    rb.removeTop();
    contains(rb, 2, 4, 6, 8);
    rb.remove(1);
    contains(rb, 2, 6, 8);
    rb.remove(2);
    contains(rb, 2, 6);
    rb.remove(0);
    contains(rb, 6);
    rb.remove(0);
    contains(rb);
}
Also used : RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 29 with RecordBuffer

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

the class TestRecordBuffer method recBuffer04.

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

Example 30 with RecordBuffer

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

the class TestRecordBuffer method recBuffer02.

@Test
public void recBuffer02() {
    RecordBuffer rb = make(4, 4);
    int idx = -1;
    idx = find(rb, 6);
    assertEquals(2, idx);
    idx = find(rb, 8);
    assertEquals(3, idx);
    idx = find(rb, 4);
    assertEquals(1, idx);
    idx = find(rb, 2);
    assertEquals(0, idx);
    idx = find(rb, 3);
    assertEquals(-2, idx);
    idx = find(rb, 0);
    assertEquals(-1, idx);
    idx = find(rb, 10);
    assertEquals(-5, idx);
}
Also used : 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