@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 ; }
BPTreeRangeIteratorMapper(BPTreeNode node, Record minRec, Record maxRec, int keyLength, RecordMapper<X> mapper) { this.minRecord = minRec ; this.maxRecord = maxRec ; this.mapper = mapper ; this.keySlot = new byte[keyLength] ; BPTreeRecords r = loadStack(node) ; current = getRecordsIterator(r, minRecord, maxRecord, mapper) ; }
@Override public X next() { if ( ! hasNext() ) throw new NoSuchElementException() ; X r = slot ; if ( r == null ) throw new InternalErrorException("Null slot after hasNext is true") ; slot = null ; return r ; } }
public void close() { if ( ! finished ) end() ; }
public static <X> Iterator<X> create(BPTreeNode node, Record minRec, Record maxRec, int keyLength, RecordMapper<X> mapper) { if ( minRec != null && maxRec != null && Record.keyGE(minRec, maxRec) ) return Iter.nullIter(); return new BPTreeRangeIteratorMapper<>(node, minRec, maxRec, keyLength, mapper) ; }
private <X> Iterator<X> iterator(BPTreeNode node, Record minRec, Record maxRec, RecordMapper<X> mapper) { int keyLen = recordsMgr.getRecordBufferPageMgr().getRecordFactory().keyLength(); return BPTreeRangeIteratorMapper.create(node, minRec, maxRec, keyLen, mapper) ; }
@Override public X next() { if ( ! hasNext() ) throw new NoSuchElementException() ; X r = slot ; if ( r == null ) throw new InternalErrorException("Null slot after hasNext is true") ; slot = null ; return r ; } }
public void close() { if ( ! finished ) end() ; }
public static <X> Iterator<X> create(BPTreeNode node, Record minRec, Record maxRec, int keyLength, RecordMapper<X> mapper) { if ( minRec != null && maxRec != null && Record.keyGE(minRec, maxRec) ) return Iter.nullIter(); return new BPTreeRangeIteratorMapper<>(node, minRec, maxRec, keyLength, mapper) ; }
private <X> Iterator<X> iterator(BPTreeNode node, Record minRec, Record maxRec, RecordMapper<X> mapper) { int keyLen = recordsMgr.getRecordBufferPageMgr().getRecordFactory().keyLength(); return BPTreeRangeIteratorMapper.create(node, minRec, maxRec, keyLen, mapper) ; }
BPTreeRangeIteratorMapper(BPTreeNode node, Record minRec, Record maxRec, int keyLength, RecordMapper<X> mapper) { this.minRecord = minRec ; this.maxRecord = maxRec ; this.mapper = mapper ; this.keySlot = new byte[keyLength] ; BPTreeRecords r = loadStack(node) ; current = getRecordsIterator(r, minRecord, maxRecord, mapper) ; }
@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<X> 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, mapper) ; }
private Iterator<X> 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, mapper) ; }