|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjdbm.htree.HashNode
jdbm.htree.HashBucket
final class HashBucket
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.
Field Summary | |
---|---|
static int |
OVERFLOW_SIZE
The maximum number of elements (key, value) a non-leaf bucket can contain. |
(package private) static long |
serialVersionUID
|
Constructor Summary | |
---|---|
HashBucket()
Public constructor for serialization. |
|
HashBucket(int level)
Construct a bucket with a given depth level. |
Method Summary | |
---|---|
java.lang.Object |
addElement(java.lang.Object key,
java.lang.Object value)
Add an element (key, value) to this bucket. |
int |
getElementCount()
Returns the number of elements contained in this bucket. |
(package private) java.util.ArrayList |
getKeys()
Obtain keys contained in this buckets. |
java.lang.Object |
getValue(java.lang.Object key)
Returns the value associated with a given key. |
(package private) java.util.ArrayList |
getValues()
Obtain values contained in this buckets. |
boolean |
hasRoom()
Returns true if bucket can accept at least one more element. |
boolean |
isLeaf()
Returns whether or not this bucket is a "leaf bucket". |
void |
readExternal(java.io.ObjectInput in)
Implement Externalizable interface. |
java.lang.Object |
removeElement(java.lang.Object key)
Remove an element, given a specific key. |
java.lang.String |
toString()
|
void |
writeExternal(java.io.ObjectOutput out)
Implement Externalizable interface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
public static final int OVERFLOW_SIZE
Constructor Detail |
---|
public HashBucket()
public HashBucket(int level)
HashDirectory
above this bucket.
Method Detail |
---|
public int getElementCount()
public boolean isLeaf()
public boolean hasRoom()
public java.lang.Object addElement(java.lang.Object key, java.lang.Object value)
null
if no association existed.public java.lang.Object removeElement(java.lang.Object key)
key
- Key of the element to remove
null
if not foundpublic java.lang.Object getValue(java.lang.Object key)
null
.
java.util.ArrayList getKeys()
getValues()
.
As an optimization, the Vector returned is the instance member
of this class. Please don't modify outside the scope of this class.
java.util.ArrayList getValues()
getKeys()
.
As an optimization, the Vector returned is the instance member
of this class. Please don't modify outside the scope of this class.
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |