@Override public boolean hasNext() { if ( finished ) return false ; if ( slot != null ) return true ; while(current != null && !current.hasNext()) { current = moveOnCurrent() ; } if ( current == null ) { end() ; return false ; } slot = current.next() ; return true ; }
BPTreeRangeIterator(BPTreeNode node, Record minRec, Record maxRec ) { this.minRecord = minRec ; this.maxRecord = maxRec ; BPTreeRecords r = loadStack(node) ; current = getRecordsIterator(r, minRecord, maxRecord) ; }
@Override public Iterator<Record> iterator(Record fromRec, Record toRec) { startReadBlkMgr() ; BPTreeNode root = getRootRead() ; releaseRootRead(root) ; finishReadBlkMgr() ; return BPTreeRangeIterator.create(root, fromRec, toRec) ; //return iterator(fromRec, toRec, RecordFactory.mapperRecord) ; }
@Override public Record next() { if ( ! hasNext() ) throw new NoSuchElementException() ; Record r = slot ; if ( r == null ) throw new InternalErrorException("Null slot after hasNext is true") ; slot = null ; return r ; } }
public static Iterator<Record> create(BPTreeNode node, Record minRec, Record maxRec) { if ( minRec != null && maxRec != null && Record.keyGE(minRec, maxRec) ) return Iter.nullIter(); return new BPTreeRangeIterator(node, minRec, maxRec) ; }
public void close() { if ( ! finished ) end() ; }
@Override public Iterator<Record> iterator(Record fromRec, Record toRec) { startReadBlkMgr() ; BPTreeNode root = getRootRead() ; releaseRootRead(root) ; finishReadBlkMgr() ; return BPTreeRangeIterator.create(root, fromRec, toRec) ; //return iterator(fromRec, toRec, RecordFactory.mapperRecord) ; }
@Override public Record next() { if ( ! hasNext() ) throw new NoSuchElementException() ; Record r = slot ; if ( r == null ) throw new InternalErrorException("Null slot after hasNext is true") ; slot = null ; return r ; } }
public static Iterator<Record> create(BPTreeNode node, Record minRec, Record maxRec) { if ( minRec != null && maxRec != null && Record.keyGE(minRec, maxRec) ) return Iter.nullIter(); return new BPTreeRangeIterator(node, minRec, maxRec) ; }
public void close() { if ( ! finished ) end() ; }
BPTreeRangeIterator(BPTreeNode node, Record minRec, Record maxRec ) { this.minRecord = minRec ; this.maxRecord = maxRec ; BPTreeRecords r = loadStack(node) ; current = getRecordsIterator(r, minRecord, maxRecord) ; }
@Override public boolean hasNext() { if ( finished ) return false ; if ( slot != null ) return true ; while(current != null && !current.hasNext()) { current = moveOnCurrent() ; } if ( current == null ) { end() ; return false ; } slot = current.next() ; return true ; }
private Iterator<Record> moveOnCurrent() { Iterator<BPTreePage> iter = null ; while(!stack.isEmpty()) { iter = stack.peek() ; if ( iter.hasNext() ) break ; stack.pop() ; } if ( iter == null || ! iter.hasNext() ) return null ; BPTreePage p = iter.next() ; BPTreeRecords r = null ; if (p instanceof BPTreeNode) { r = loadStack((BPTreeNode)p) ; } else { r = (BPTreeRecords)p ; } return getRecordsIterator(r, minRecord, maxRecord) ; }
private Iterator<Record> moveOnCurrent() { Iterator<BPTreePage> iter = null ; while(!stack.isEmpty()) { iter = stack.peek() ; if ( iter.hasNext() ) break ; stack.pop() ; } if ( iter == null || ! iter.hasNext() ) return null ; BPTreePage p = iter.next() ; BPTreeRecords r = null ; if (p instanceof BPTreeNode) { r = loadStack((BPTreeNode)p) ; } else { r = (BPTreeRecords)p ; } return getRecordsIterator(r, minRecord, maxRecord) ; }