K - The type for the KeyV - The type for the stored valueinterface Page<K,V>
PageIO (they will be linked)| Modifier and Type | Method and Description |
|---|---|
TupleCursor<K,V> |
browse(K key,
ReadTransaction<K,V> transaction,
ParentPos<K,V>[] stack,
int depth)
Browses the tree, looking for the given key, and creates a Cursor on top
of the found result.
|
TupleCursor<K,V> |
browse(ReadTransaction<K,V> transaction,
ParentPos<K,V>[] stack,
int depth)
Browses the whole tree, and creates a Cursor on top of it.
|
KeyCursor<K> |
browseKeys(ReadTransaction<K,K> transaction,
ParentPos<K,K>[] stack,
int depth)
Browses the keys of whole tree, and creates a Cursor on top of it.
|
boolean |
contains(K key,
V value)
Checks if the page contains the given key with the given value.
|
DeleteResult<K,V> |
delete(K key,
V value,
long revision)
Deletes the value from an entry associated with the given key in this page.
|
java.lang.String |
dumpPage(java.lang.String tabs)
Pretty-prints the tree with tabs
|
Tuple<K,V> |
findLeftMost()
Finds the leftmost element in this page.
|
int |
findPos(K key)
Find the position of the given key in the page.
|
Tuple<K,V> |
findRightMost()
Finds the rightmost element in this page.
|
V |
get(K key)
Gets the value associated with the given key, if any.
|
K |
getKey(int pos)
Returns the key at a given position
|
K |
getLeftMostKey()
Finds the leftmost key in this page.
|
int |
getNbElems() |
long |
getRevision() |
K |
getRightMostKey()
Finds the rightmost key in this page.
|
ValueCursor<V> |
getValues(K key)
Gets the values associated with the given key, if any.
|
boolean |
hasKey(K key)
Checks if the given key exists.
|
InsertResult<K,V> |
insert(K key,
V value,
long revision)
Inserts the given key and value into this page.
|
boolean |
isLeaf()
Tells if the page is a leaf or not
|
boolean |
isNode()
Tells if the page is a node or not
|
int getNbElems()
InsertResult<K,V> insert(K key, V value, long revision) throws java.io.IOException
key - Inserted keyvalue - Inserted valuerevision - The new revision for the modified pagesjava.io.IOException - If we have an error while trying to access the pageDeleteResult<K,V> delete(K key, V value, long revision) throws java.io.IOException
revision - The new revision for the modified pageskey - The key to deletevalue - The value to delete (can be null)parent - The parent pageparentPos - The position of the current page in it's parentjava.io.IOException - If we have an error while trying to access the pageV get(K key) throws KeyNotFoundException, java.io.IOException
key - The key we are looking forKeyNotFoundException - If no entry with the given key can be foundjava.io.IOException - If we have an error while trying to access the pageValueCursor<V> getValues(K key) throws KeyNotFoundException, java.io.IOException, java.lang.IllegalArgumentException
key - The key we are looking forKeyNotFoundException - If no entry with the given key can be foundjava.io.IOException - If we have an error while trying to access the pagejava.lang.IllegalArgumentException - If duplicates are not enabledboolean contains(K key, V value) throws java.io.IOException
key - The key we are looking forvalue - The value associated with the given keyjava.io.IOExceptionTupleCursor<K,V> browse(K key, ReadTransaction<K,V> transaction, ParentPos<K,V>[] stack, int depth) throws java.io.IOException
key - The key we are looking for.transaction - The started transaction for this operationstack - The stack of parents we go through to get to this pagejava.io.IOException - If we have an error while trying to access the pageTupleCursor<K,V> browse(ReadTransaction<K,V> transaction, ParentPos<K,V>[] stack, int depth) throws EndOfFileExceededException, java.io.IOException
transaction - The started transaction for this operationstack - The stack of parents we go through to get to this pagejava.io.IOException - If we have an error while trying to access the pageEndOfFileExceededExceptionKeyCursor<K> browseKeys(ReadTransaction<K,K> transaction, ParentPos<K,K>[] stack, int depth) throws EndOfFileExceededException, java.io.IOException
transaction - The started transaction for this operationstack - The stack of parents we go through to get to this pagejava.io.IOException - If we have an error while trying to access the pageEndOfFileExceededExceptionlong getRevision()
K getKey(int pos)
pos - The position of the key we want to retrieveK getLeftMostKey()
K getRightMostKey()
Tuple<K,V> findLeftMost() throws java.io.IOException
java.io.IOException - If we have an error while trying to access the pageTuple<K,V> findRightMost() throws EndOfFileExceededException, java.io.IOException
java.io.IOException - If we have an error while trying to access the pageEndOfFileExceededExceptionjava.lang.String dumpPage(java.lang.String tabs)
tabs - The tabs to add in front of each nodeint findPos(K key)
+---+---+---+---+ | b | d | f | h | +---+---+---+---+ 0 1 2 3looking for 'b' will return -1 (-(0+1)) and looking for 'f' will return -3 (-(2+1)).
key - The key to findboolean hasKey(K key) throws java.io.IOException
key - The key we are looking atjava.io.IOException - If we have an error while trying to access the pageboolean isLeaf()
boolean isNode()