Search in sources :

Example 11 with PtrBuffer

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

the class TestPtrBuffer method ptrbuffer21.

@Test
public void ptrbuffer21() {
    PtrBuffer pb1 = make(3, 5);
    contains(pb1, 2, 4, 6);
    PtrBuffer pb2 = make(0, 5);
    contains(pb2);
    pb1.shiftRight(pb2);
    contains(pb1, 2, 4);
    contains(pb2, 6);
}
Also used : PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 12 with PtrBuffer

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

the class TestPtrBuffer method ptrbuffer05.

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

Example 13 with PtrBuffer

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

the class TestPtrBuffer method ptrbuffer09.

// Errors - IllegalArgumentException
@Test(expected = BufferException.class)
public void ptrbuffer09() {
    PtrBuffer pb = make(4, 5);
    contains(pb, 2, 4, 6, 8);
    pb.shiftDown(4);
}
Also used : PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 14 with PtrBuffer

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

the class TestPtrBuffer method make.

private static PtrBuffer make(int n, int len) {
    ByteBuffer bb = ByteBuffer.allocate(4 * len);
    PtrBuffer pb = new PtrBuffer(bb, 0);
    for (int i = 0; i < n; i++) pb.add(2 + 2 * i);
    return pb;
}
Also used : ByteBuffer(java.nio.ByteBuffer) PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer)

Example 15 with PtrBuffer

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

the class TestPtrBuffer method ptrbuffer27.

@Test
public void ptrbuffer27() {
    PtrBuffer pb1 = make(2, 4);
    PtrBuffer pb2 = make(2, 4);
    pb1.copyToTop(pb2);
    contains(pb2, 2, 4, 2, 4);
}
Also used : PtrBuffer(org.apache.jena.tdb.base.buffer.PtrBuffer) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

PtrBuffer (org.apache.jena.tdb.base.buffer.PtrBuffer)27 BaseTest (org.apache.jena.atlas.junit.BaseTest)23 Test (org.junit.Test)23 RecordBuffer (org.apache.jena.tdb.base.buffer.RecordBuffer)3 ByteBuffer (java.nio.ByteBuffer)2 Record (org.apache.jena.tdb.base.record.Record)1