| java.lang.Object jdbm.btree.BPage
BPage | final public class BPage implements Serializer(Code) | | Page of a Btree.
The page contains a number of key-value pairs. Keys are ordered to allow
dichotomic search.
If the page is a leaf page, the keys and values are user-defined and
represent entries inserted by the user.
If the page is non-leaf, each key represents the greatest key in the
underlying BPages and the values are recids pointing to the children BPages.
The only exception is the rightmost BPage, which is considered to have an
"infinite" key value, meaning that any insert will be to the left of this
pseudo-key
author: Alex Boisvert version: $Id: BPage.java,v 1.6 2003/09/21 15:46:59 boisvert Exp $ |
Inner Class :static class InsertResult | |
Inner Class :static class RemoveResult | |
Method Summary | |
void | assertConsistencyRecursive(int height) Recursively assert the ordering of the BPage entries on this page
and sub-pages. | BPage | childBPage(int index) Return the child BPage at given index. | public Object | deserialize(byte[] serialized) Deserialize the content of an object from a byte array. | void | dumpRecursive(int height, int level) Recursively dump the state of the BTree on screen. | TupleBrowser | find(int height, Object key) Find the object associated with the given key. | TupleBrowser | findFirst() Find first entry and return a browser positioned before it. | Object | getLargestKey() Get largest key under this BPage. | InsertResult | insert(int height, Object key, Object value, boolean replace) Insert the given key and value.
Since the Btree does not support duplicate entries, the caller must
specify whether to replace the existing value.
Parameters: height - Height of the current BPage (zero is leaf page) Parameters: key - Insert key Parameters: value - Insert value Parameters: replace - Set to true to replace the existing value, if one exists. | boolean | isEmpty() Return true if BPage is empty. | boolean | isFull() Return true if BPage is full. | static byte[] | readByteArray(ObjectInput in) | RemoveResult | remove(int height, Object key) Remove the entry associated with the given key. | public byte[] | serialize(Object obj) Serialize the content of an object into a byte array. | static void | writeByteArray(ObjectOutput out, byte[] buf) |
_children | protected long[] _children(Code) | | Children pages (recids) associated with keys. (Only valid if non-leaf BPage)
|
_first | protected int _first(Code) | | Index of first used item at the page
|
_isLeaf | protected boolean _isLeaf(Code) | | Flag indicating if this is a leaf BPage.
|
_next | protected long _next(Code) | | Next leaf BPage (only if this BPage is a leaf)
|
_previous | protected long _previous(Code) | | Previous leaf BPage (only if this BPage is a leaf)
|
_recid | protected transient long _recid(Code) | | This BPage's record ID in the PageManager.
|
_values | protected Object[] _values(Code) | | Values associated with keys. (Only valid if leaf BPage)
|
serialVersionUID | final static long serialVersionUID(Code) | | Version id for serialization.
|
BPage | public BPage()(Code) | | No-argument constructor used by serialization.
|
BPage | BPage(BTree btree, boolean isLeaf) throws IOException(Code) | | Overflow page constructor. Creates an empty BPage.
|
assertConsistencyRecursive | void assertConsistencyRecursive(int height) throws IOException(Code) | | Recursively assert the ordering of the BPage entries on this page
and sub-pages. This is used for testing purposes only.
|
deserialize | public Object deserialize(byte[] serialized) throws IOException(Code) | | Deserialize the content of an object from a byte array.
Parameters: serialized - Byte array representation of the object deserialized object |
dumpRecursive | void dumpRecursive(int height, int level) throws IOException(Code) | | Recursively dump the state of the BTree on screen. This is used for
debugging purposes only.
|
find | TupleBrowser find(int height, Object key) throws IOException(Code) | | Find the object associated with the given key.
Parameters: height - Height of the current BPage (zero is leaf page) Parameters: key - The key TupleBrowser positionned just before the given key, or beforenext greater key if key isn't found. |
findFirst | TupleBrowser findFirst() throws IOException(Code) | | Find first entry and return a browser positioned before it.
TupleBrowser positionned just before the first entry. |
getLargestKey | Object getLargestKey()(Code) | | Get largest key under this BPage. Null is considered to be the
greatest possible key.
|
insert | InsertResult insert(int height, Object key, Object value, boolean replace) throws IOException(Code) | | Insert the given key and value.
Since the Btree does not support duplicate entries, the caller must
specify whether to replace the existing value.
Parameters: height - Height of the current BPage (zero is leaf page) Parameters: key - Insert key Parameters: value - Insert value Parameters: replace - Set to true to replace the existing value, if one exists. Insertion result containing existing value OR a BPage if the keywas inserted and provoked a BPage overflow. |
isEmpty | boolean isEmpty()(Code) | | Return true if BPage is empty.
|
isFull | boolean isFull()(Code) | | Return true if BPage is full.
|
remove | RemoveResult remove(int height, Object key) throws IOException(Code) | | Remove the entry associated with the given key.
Parameters: height - Height of the current BPage (zero is leaf page) Parameters: key - Removal key Remove result object |
serialize | public byte[] serialize(Object obj) throws IOException(Code) | | Serialize the content of an object into a byte array.
Parameters: obj - Object to serialize a byte array representing the object's state |
|
|