public Map.Entry<Key,Value> getFirst(Transaction tx) throws IOException { BTreeNode<Key, Value> node = this; while( node .isBranch() ) { node = node.getChild(tx, 0); } if( node.values.length>0 ) { return new KeyValueEntry(node.keys[0], node.values[0]); } else { return null; } }
synchronized public Value put(Transaction tx, Key key, Value value) throws IOException { assertLoaded(); return getRoot(tx).put(tx, key, value); }
public synchronized boolean containsKey(Transaction tx, Key key) throws IOException { assertLoaded(); return getBin(tx, key).containsKey(key); }
synchronized public boolean containsKey(Transaction tx, Key key) throws IOException { assertLoaded(); return getRoot(tx).contains(tx, key); }
synchronized public Value get(Transaction tx, Key key) throws IOException { assertLoaded(); return getRoot(tx).get(tx, key); }
synchronized public void printStructure(Transaction tx, PrintWriter out) throws IOException { getRoot(tx).printStructure(tx, out, ""); }
synchronized public Iterator<ListNode<Key, Value>> listNodeIterator(Transaction tx) throws IOException { return getHead(tx).listNodeIterator(tx); }
synchronized public int getMaxLeafDepth(Transaction tx) throws IOException { return getRoot(tx).getMaxLeafDepth(tx, 0); }
public Iterator<Map.Entry<Key,Value>> iterator(final Transaction tx) throws IOException { return new BTreeIterator(tx, getFirstLeafNode(tx), 0, null); }
public Map.Entry<Key,Value> getLast(Transaction tx) throws IOException { BTreeNode<Key, Value> node = this; while( node.isBranch() ) { node = node.getChild(tx, node.children.length-1); } if( node.values.length>0 ) { int idx = node.values.length-1; return new KeyValueEntry(node.keys[idx], node.values[idx]); } else { return null; } }