| java.lang.Object jdbm.htree.HashNode jdbm.htree.HashBucket
HashBucket | final class HashBucket extends HashNode implements Externalizable(Code) | | A bucket is a placeholder for multiple (key, value) pairs. Buckets
are used to store collisions (same hash value) at all levels of an
H*tree.
There are two types of buckets: leaf and non-leaf.
Non-leaf buckets are buckets which hold collisions which happen
when the H*tree is not fully expanded. Keys in a non-leaf buckets
can have different hash codes. Non-leaf buckets are limited to an
arbitrary size. When this limit is reached, the H*tree should create
a new Directory page and distribute keys of the non-leaf buckets into
the newly created Directory.
A leaf bucket is a bucket which contains keys which all have
the same hashCode() . Leaf buckets stand at the
bottom of an H*tree because the hashing algorithm cannot further
discriminate between different keys based on their hash code.
author: Alex Boisvert version: $Id: HashBucket.java,v 1.2 2005/06/25 23:12:32 doomdark Exp $ |
Field Summary | |
final public static int | OVERFLOW_SIZE The maximum number of elements (key, value) a non-leaf bucket
can contain. | final static long | serialVersionUID |
Constructor Summary | |
public | HashBucket() Public constructor for serialization. | public | HashBucket(int level) Construct a bucket with a given depth level. |
OVERFLOW_SIZE | final public static int OVERFLOW_SIZE(Code) | | The maximum number of elements (key, value) a non-leaf bucket
can contain.
|
serialVersionUID | final static long serialVersionUID(Code) | | |
HashBucket | public HashBucket()(Code) | | Public constructor for serialization.
|
HashBucket | public HashBucket(int level)(Code) | | Construct a bucket with a given depth level. Depth level is the
number of HashDirectory above this bucket.
|
addElement | public Object addElement(Object key, Object value)(Code) | | Add an element (key, value) to this bucket. If an existing element
has the same key, it is replaced silently.
Object which was previously associated with the given keyor null if no association existed. |
getElementCount | public int getElementCount()(Code) | | Returns the number of elements contained in this bucket.
|
getKeys | ArrayList getKeys()(Code) | | Obtain keys contained in this buckets. Keys are ordered to match
their values, which be be obtained by calling getValues() .
As an optimization, the Vector returned is the instance member
of this class. Please don't modify outside the scope of this class.
|
getValue | public Object getValue(Object key)(Code) | | Returns the value associated with a given key. If the given key
is not found in this bucket, returns null .
|
getValues | ArrayList getValues()(Code) | | Obtain values contained in this buckets. Values are ordered to match
their keys, which be be obtained by calling getKeys() .
As an optimization, the Vector returned is the instance member
of this class. Please don't modify outside the scope of this class.
|
hasRoom | public boolean hasRoom()(Code) | | Returns true if bucket can accept at least one more element.
|
isLeaf | public boolean isLeaf()(Code) | | Returns whether or not this bucket is a "leaf bucket".
|
removeElement | public Object removeElement(Object key)(Code) | | Remove an element, given a specific key.
Parameters: key - Key of the element to remove Removed element value, or null if not found |
|
|