private void prefetch() throws IOException { success = browser.getNext( jdbmTuple ); }
private void prefetch() throws IOException { if ( stepForward ) { success = browser.getNext( jdbmTuple ); } else { success = browser.getPrevious( jdbmTuple ); } }
public K lastKey() { if(size() == 0) throw new NoSuchElementException(); try{ TupleBrowser<K,V> b = toKey==null?tree.browse(null):tree.browse(toKey); Tuple<K,V> t = new Tuple<K,V>(); b.getPrevious(t); return t.getKey(); }catch(IOException e){ throw new IOError(e); } }
@Override public boolean previous() throws LdapException, CursorException { try { if ( browser == null ) { browser = btree.browse( null ); } if ( browser.getPrevious( tuple ) ) { return true; } } catch ( IOException e ) { throw new CursorException( e ); } catch ( NoSuchElementException e ) { // ignore this is due to the call wrapped.prev() // instead of doing a check like if(wrapped.hasPrev()) } clearValue(); return false; }
/** * Dumps the tree past the key to debug. */ public void dump(Object key) throws IOException { TupleBrowser browser = tree.browse(key); Tuple t = new Tuple(); log.debug("contents: " + key); while (browser.getNext(t)) { log.debug(t.getKey() + "\t" + t.getValue()); } log.debug(""); }
private void prefetch() throws IOException { if ( doAscending ) { success = browser.getNext( jdbmTuple ); } else { success = browser.getPrevious( jdbmTuple ); } }
/** * @see TupleBrowser#getPrevious(Tuple) */ public boolean getPrevious( Tuple tuple ) throws NamingException { boolean isSuccess = false; synchronized ( jdbmTuple ) { try { isSuccess = jdbmBrowser.getPrevious( jdbmTuple ); } catch ( IOException ioe ) { NamingException ne = new NamingException( "Failed on call to jdbm TupleBrowser.getPrevious()" ); ne.setRootCause( ioe ); throw ne; } if ( isSuccess ) { tuple.setKey( jdbmTuple.getKey() ); tuple.setValue( jdbmTuple.getValue() ); } } return isSuccess; } }
/** * Find the value associated with the given key, or the entry immediately * following this key in the ordered BTree. * * @param key Lookup key. * @return Value associated with the key, or a greater entry, or null if no * greater entry was found. */ public synchronized Tuple<K,V> findGreaterOrEqual( K key ) throws IOException { Tuple<K,V> tuple; TupleBrowser<K,V> browser; if ( key == null ) { // there can't be a key greater than or equal to "null" // because null is considered an infinite key. return null; } tuple = new Tuple<K,V>( null, null ); browser = browse( key ); if ( browser.getNext( tuple ) ) { return tuple; } else { return null; } }
return browser.getNext( tuple ); if ( browser.getPrevious( tuple ) ) browser.getNext( tuple );
if ( browser.getPrevious( tuple ) )
/** * Find the value associated with the given key, or the entry immediately * following this key in the ordered BTree. * * @param key Lookup key. * @return Value associated with the key, or a greater entry, or null if no * greater entry was found. */ public synchronized Tuple<K, V> findGreaterOrEqual( K key ) throws IOException { Tuple<K, V> tuple; TupleBrowser<K, V> browser; if ( key == null ) { // there can't be a key greater than or equal to "null" // because null is considered an infinite key. return null; } tuple = new Tuple<K, V>( null, null ); browser = browse( key ); if ( browser.getNext( tuple ) ) { return tuple; } else { return null; } }
boolean gotNextOk = browser.getNext( jdbmTuple ); if ( gotNextOk ) if ( compared != 0 ) browser.getPrevious( jdbmTuple );
/** * {@inheritDoc} */ public boolean previous() throws LdapException, CursorException { checkNotClosed(); try { if ( browser == null ) { browser = btree.browse( null ); } if ( browser.getPrevious( tuple ) ) { valueAvailable = true; return true; } else { clearValue(); return false; } } catch ( IOException e ) { throw new CursorException( e ); } }
/** * Find the value associated with the given key, or the entry immediately * following this key in the ordered BTree. * * @param key Lookup key. * @return Value associated with the key, or a greater entry, or null if no * greater entry was found. */ public synchronized Tuple findGreaterOrEqual( Object key ) throws IOException { Tuple tuple; TupleBrowser browser; if ( key == null ) { // there can't be a key greater than or equal to "null" // because null is considered an infinite key. return null; } tuple = new Tuple( null, null ); browser = browse( key ); if ( browser.getNext( tuple ) ) { return tuple; } else { return null; } }
if ( isGreaterThan ) boolean success = browser.getNext( tuple ); if ( success ) boolean success = browser.getPrevious( tuple ); if ( success ) success = browser.getNext( tuple ); if ( success )
if ( browser.getPrevious( valueTuple ) ) && ( comparator.compare( ( V ) valueTuple.getKey(), returnedTuple.getValue() ) == 0 ) ) browser.getPrevious( valueTuple );
while ( browser.getNext( tuple ) ) browser.getPrevious( tuple ); clearValue(); return;