Package com.hp.hpl.jena.tdb.base.record

Examples of com.hp.hpl.jena.tdb.base.record.Record


    @Override
    public Record next()
    {
        if ( !hasNext() ) throw new NoSuchElementException() ;
        Record r = slot ;
        slot = null ;
        return r ;
    }
View Full Code Here


        RecordFactory rf = bpt1.getRecordFactory() ;
       
        Iterator<Record> iter1 = bpt1.iterator() ;
        long counter = 0 ;
        // Use the same slot each time.
        Record r2 = rf.create() ;
       
        for ( ; iter1.hasNext(); )
        {
            counter++ ;
            Record r = iter1.next() ;
            byte[] key1 = r.getKey() ;
           
            long i1 = Bytes.getLong(key1, 0 ) ;
            long i2 = Bytes.getLong(key1, 8 ) ;
            long i3 = Bytes.getLong(key1, 16 ) ;
           
View Full Code Here

public class RecordLib
{
    public static void main(String...argv)
    {
        RecordFactory rf = new RecordFactory(8,4) ;
        Record r = rf.create() ;
        Bytes.setLong(0x123456789ABCDEF0L, r.getKey()) ;
        Bytes.setInt(0x22334455, r.getValue()) ;
        ColumnMap cMap = new ColumnMap("XYAB", "BYXA") ;
        Record r2 = copyRecord(rf, r, cMap) ;
        System.out.println(r) ;
        System.out.println(r2) ;
    }
View Full Code Here

            recordFactory = new RecordFactory(kLen, vLen) ;
        int N = colMap.length() ;
        if ( kLen%N != 0 )
            throw new RecordException("Key length is not a multiple of the number of slots") ;
        int itemLen = kLen/N ;
        Record record2 = recordFactory.create() ;
        byte[] k = record2.getKey() ;
        for ( int i = 0 ; i < N ; i++ )
        {
            int j = colMap.mapSlotIdx(i) ;
            System.arraycopy(record.getKey(), i*itemLen, record2.getKey(), j*itemLen, itemLen) ;
        }
        if ( vLen != 0 )
            System.arraycopy(record.getValue(), 0, record2.getValue(), 0, vLen) ;
        return record2 ;
    }
View Full Code Here

        RecordFactory rf = bpt1.getRecordFactory() ;
       
        Iterator<Record> iter1 = bpt1.iterator() ;
        long counter = 0 ;
        // Use the same slot each time.
        Record r2 = rf.create() ;
       
        for ( ; iter1.hasNext(); )
        {
            counter++ ;
            Record r = iter1.next() ;
            byte[] key1 = r.getKey() ;
           
            long i1 = Bytes.getLong(key1, 0 ) ;
            long i2 = Bytes.getLong(key1, 8 ) ;
            long i3 = Bytes.getLong(key1, 16 ) ;
           
View Full Code Here

        {
            @Override
            public Pair<Integer, Record> convert(RecordBufferPage rbp)
            {
                mgr.put(rbp) ;
                Record r = rbp.getRecordBuffer().getHigh() ;
                r = bpt.getRecordFactory().createKeyOnly(r) ;
                return new Pair<Integer, Record>(rbp.getId(), r) ;
            }
        } ;
        // Write and convert to split pairs.
View Full Code Here

           
            // Wrong calculatation.
            for ( int i = page2.getCount() ; i <  page1.getMaxSize()/2 ; i++ )
            {
                //shiftOneup(node1, node2) ;
                Record r = page1.getRecordBuffer().getHigh() ;
                page1.getRecordBuffer().removeTop() ;

                page2.getRecordBuffer().add(0, r) ;
            }

            mgr.put(page1) ;
            mgr.put(page2) ;
           
            Record splitPoint = page1.getRecordBuffer().getHigh() ;
            splitPoint = bpt.getRecordFactory().createKeyOnly(splitPoint) ;
            //Record splitPoint = node1.maxRecord() ;
            return splitPoint ;
        }
View Full Code Here

            if ( pair1 == null || pair2 == null )
                // Insufficient blocks to repack.
                return ;
           
            if ( debug ) System.out.printf("Rebalance: %s %s\n", pair1, pair2) ;
            Record newSplitPoint = rebalance(pair1.car(), pair1.cdr(), pair2.car(), pair2.cdr()) ;
            // Needed??
            if ( newSplitPoint != null )
            {
                if ( debug ) System.out.println("Reset split point: "+pair1.cdr()+" => "+newSplitPoint) ;
                pair1 = new Pair<Integer, Record>(pair1.car(), newSplitPoint) ;
View Full Code Here

            // ** Need rebalance of data leaf layer.
            int x = node2.getCount() ;
            if ( node2.getCount() >= bpt.getParams().getMinRec() )
                return null ;

            Record splitPoint = r1 ;
           
            // Shift up all in one go and use .set.
            // Convert to block move ; should be code in BPTreeNode to do this (insert).
            for ( int i = node2.getCount() ; i <  bpt.getParams().getMinRec() ; i++ )
            {

                Record r = splitPoint ;

                //shiftOneup(node1, node2) ;
                int ptr = node1.getPtrBuffer().getHigh() ;
                splitPoint = node1.getRecordBuffer().getHigh() ;

View Full Code Here

    {
        Hash hash = new Hash(nodeHashToId.getRecordFactory().keyLength()) ;
        setHash(hash, node) ;
        byte k[] = hash.getBytes() ;       
        // Key only.
        Record r = nodeHashToId.getRecordFactory().create(k) ;
       
        synchronized (this// Pair to readNodeFromTable.
        {
            // Key and value, or null
            Record r2 = nodeHashToId.find(r) ;
            if ( r2 != null )
            {
                // Found.  Get the NodeId.
                NodeId id = NodeId.create(r2.getValue(), 0) ;
                return id ;
            }

            // Not found.
            if ( ! create )
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.tdb.base.record.Record

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.