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

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


    @Override
    public Record find(Record record)
    {
        startReadBlkMgr() ;
        BPTreeNode root = getRoot() ;
        Record v = BPTreeNode.search(root, record) ;
        releaseRoot(root) ;
        finishReadBlkMgr() ;
        return v ;
    }
View Full Code Here


    }
   
    @Override
    public boolean contains(Record record)
    {
        Record r = find(record) ;
        return r != null ;
    }
View Full Code Here

    @Override
    public Record minKey()
    {
        startReadBlkMgr() ;
        BPTreeNode root = getRoot() ;
        Record r = root.minRecord();
        releaseRoot(root) ;
        finishReadBlkMgr() ;
        return r ;
    }
View Full Code Here

    @Override
    public Record maxKey()
    {
        startReadBlkMgr() ;
        BPTreeNode root = getRoot() ;
        Record r = root.maxRecord() ;
        releaseRoot(root) ;
        finishReadBlkMgr() ;
        return r ;
    }
View Full Code Here

    /** Add a record into the B+Tree */
    public Record addAndReturnOld(Record record)
    {
        startUpdateBlkMgr() ;
        BPTreeNode root = getRoot() ;
        Record r = BPTreeNode.insert(root, record) ;
        if ( CheckingTree ) root.checkNodeDeep() ;
        releaseRoot(root) ;
        finishUpdateBlkMgr() ;
        return r ;
    }
View Full Code Here

   
    public Record deleteAndReturnOld(Record record)
    {
        startUpdateBlkMgr() ;
        BPTreeNode root = getRoot() ;
        Record r = BPTreeNode.delete(root, record) ;
        if ( CheckingTree ) root.checkNodeDeep() ;
        releaseRoot(root) ;
        finishUpdateBlkMgr() ;
        return r ;
    }
View Full Code Here

                if ( ! iter.hasNext() )
                    System.out.println("<<Empty>>") ;
               
                for ( ; iter.hasNext() ; )
                {
                    Record r = iter.next();
                    printRecord("", System.out, r, keyUnitLen) ;
                }
            }
           
            // Check.
            Iterator<Record> iterCheck = bpt.iterator() ;
            Record r1 = null ;
            int i = 0 ;
            for ( ; iterCheck.hasNext() ; )
            {
                Record r2 = iterCheck.next();
                i++ ;
               
                if ( r1 != null )
                {
                    if ( ! Record.keyLT(r1, r2) )
View Full Code Here

   
    /** Insert a tuple - return true if it was really added, false if it was a duplicate */
    @Override
    protected boolean performAdd(Tuple<NodeId> tuple)
    {
        Record r = TupleLib.record(factory, tuple, colMap) ;
        return index.add(r) ;
    }
View Full Code Here

   
    /** Delete a tuple - return true if it was deleted, false if it didn't exist */
    @Override
    protected boolean performDelete(Tuple<NodeId> tuple)
    {
        Record r = TupleLib.record(factory, tuple, colMap) ;
        return index.delete(r) ;
    }
View Full Code Here

        int numSlots = 0 ;
        int leadingIdx = -2;    // Index of last leading pattern NodeId.  Start less than numSlots-1
        boolean leading = true ;
       
        // Records.
        Record minRec = factory.createKeyOnly() ;
        Record maxRec = factory.createKeyOnly() ;
       
        for ( int i = 0 ; i < pattern.size() ; i++ )
        {
            NodeId X = pattern.get(i) ;
            if ( NodeId.isAny(X) )
                X = null ;
           
            if ( X != null )
            {
                numSlots++ ;
                if ( leading )
                {
                    leadingIdx = i ;
                    Bytes.setLong(X.getId(), minRec.getKey(), i*SizeOfNodeId) ;
                    Bytes.setLong(X.getId(), maxRec.getKey(), i*SizeOfNodeId) ;
                }
            }
            else
                // Not leading key slots.
                leading = false ;
        }
       
        // Is it a simple existence test?
        if ( numSlots == pattern.size() )
        {
            if ( index.contains(minRec) )
                return new SingletonIterator<Tuple<NodeId>>(pattern)
            else
                return new NullIterator<Tuple<NodeId>>() ;
        }
       
        Iterator<Record> iter = null ;
       
        if ( leadingIdx < 0 )
        {
            if ( ! fullScanAllowed )
                return null ;
            //System.out.println("Full scan") ;
            // Full scan necessary
            iter = index.iterator() ;
        }
        else
        {
            // Adjust the maxRec.
            NodeId X = pattern.get(leadingIdx) ;
            // Set the max Record to the leading NodeIds, +1.
            // Example, SP? inclusive to S(P+1)? exclusive where ? is zero.
            Bytes.setLong(X.getId()+1, maxRec.getKey(), leadingIdx*SizeOfNodeId) ;
            iter = index.iterator(minRec, maxRec) ;
        }
       
        Iterator<Tuple<NodeId>> tuples = Iter.map(iter, transformToTuple) ;
       
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.