/** * {@inheritDoc} */ /* no qualifier */Page<K, V> getPage( int pos ) { if ( ( pos >= 0 ) && ( pos < children.length ) ) { if ( children[pos] != null ) { return children[pos].getValue(); } else { return null; } } else { return null; } }
/** * {@inheritDoc} */ /* no qualifier */Page<K, V> getReference( int pos ) throws IOException { if ( pos < nbElems + 1 ) { if ( children[pos] != null ) { return children[pos].getValue(); } else { return null; } } else { return null; } }
/** * {@inheritDoc} */ public Tuple<K, V> findRightMost() throws EndOfFileExceededException, IOException { return children[nbElems].getValue().findRightMost(); }
/** * {@inheritDoc} */ public K getLeftMostKey() { return children[0].getValue().getLeftMostKey(); }
/** * {@inheritDoc} */ public K getLeftMostKey() { return children[0].getValue().getLeftMostKey(); }
/** * {@inheritDoc} */ public Tuple<K, V> findLeftMost() throws EndOfFileExceededException, IOException { return children[0].getValue().findLeftMost(); }
/** * {@inheritDoc} */ public String dumpPage( String tabs ) { StringBuilder sb = new StringBuilder(); if ( nbElems > 0 ) { // Start with the first child sb.append( children[0].getValue().dumpPage( tabs + " " ) ); for ( int i = 0; i < nbElems; i++ ) { sb.append( tabs ); sb.append( "<" ); sb.append( getKey( i ) ).append( ">\n" ); sb.append( children[i + 1].getValue().dumpPage( tabs + " " ) ); } } return sb.toString(); }
/** * {@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} */ public TupleCursor<K, V> browse( ReadTransaction<K, V> transaction, ParentPos<K, V>[] stack, int depth ) throws IOException { stack[depth++] = new ParentPos<K, V>( this, 0 ); Page<K, V> page = children[0].getValue(); return page.browse( transaction, stack, depth ); }
/** * {@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 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} */ public KeyCursor<K> browseKeys( ReadTransaction<K, K> transaction, ParentPos<K, K>[] stack, int depth ) throws IOException { stack[depth++] = new ParentPos( this, 0 ); Page<K, V> page = children[0].getValue(); return page.browseKeys( transaction, stack, depth ); }
/** * {@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 ); } }
/** * {@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 ); }
Page<K, V> child = children[pos].getValue();
( ( PersistedBTree<K, V> ) btree ).setRootPage( rootHolder.getValue() );