/** * {@inheritDoc} */ public TupleCursor<K, V> browse( K key, ReadTransaction<K, V> transaction, ParentPos<K, V>[] stack, int depth ) throws IOException { int pos = findPos( key ); if ( pos < 0 ) { pos = -pos; } // We first stack the current page stack[depth++] = new ParentPos<K, V>( this, pos ); Page<K, V> page = children[pos].getValue(); return page.browse( key, transaction, stack, depth ); }
/** * {@inheritDoc} */ public V get( K key ) throws IOException, KeyNotFoundException { int pos = findPos( key ); if ( pos < 0 ) { // Here, if we have found the key in the node, then we must go down into // the right child, not the left one return children[-pos].getValue().get( key ); } else { return children[pos].getValue().get( key ); } }
/** * {@inheritDoc} */ @Override public ValueCursor<V> getValues( K key ) throws KeyNotFoundException, IOException, IllegalArgumentException { int pos = findPos( key ); if ( pos < 0 ) { // Here, if we have found the key in the node, then we must go down into // the right child, not the left one return children[-pos].getValue().getValues( key ); } else { return children[pos].getValue().getValues( key ); } }
/** * {@inheritDoc} */ @Override public boolean contains( K key, V value ) throws IOException { int pos = findPos( key ); if ( pos < 0 ) { // Here, if we have found the key in the node, then we must go down into // the right child, not the left one return children[-pos].getValue().contains( key, value ); } else { return children[pos].getValue().contains( key, value ); } }
/** * {@inheritDoc} */ @Override public boolean hasKey( K key ) throws IOException { int pos = findPos( key ); if ( pos < 0 ) { // Here, if we have found the key in the node, then we must go down into // the right child, not the left one return children[-pos].getValue().hasKey( key ); } else { Page<K, V> page = children[pos].getValue(); return page.hasKey( key ); } }