|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgnu.trove.impl.hash.THash
gnu.trove.impl.hash.TPrimitiveHash
public abstract class TPrimitiveHash
The base class for hashtables of primitive values. Since there is no notion of object equality for primitives, it isn't possible to use a `REMOVED' object to track deletions in an open-addressed table. So, we have to resort to using a parallel `bookkeeping' array of bytes, in which flags can be set to indicate that a particular slot in the hash table is FREE, FULL, or REMOVED.
| Field Summary | |
|---|---|
byte[] |
_states
flags indicating whether each position in the hash is FREE, FULL, or REMOVED |
static byte |
FREE
flag indicating that a slot in the hashtable is available |
static byte |
FULL
flag indicating that a slot in the hashtable is occupied |
static byte |
REMOVED
flag indicating that the value of a slot in the hashtable was deleted |
| Fields inherited from class gnu.trove.impl.hash.THash |
|---|
_autoCompactionFactor, _autoCompactRemovesRemaining, _autoCompactTemporaryDisable, _free, _loadFactor, _maxSize, _size, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR |
| Constructor Summary | |
|---|---|
TPrimitiveHash()
Creates a new THash instance with the default
capacity and load factor. |
|
TPrimitiveHash(int initialCapacity)
Creates a new TPrimitiveHash instance with a prime
capacity at or near the specified capacity and with the default
load factor. |
|
TPrimitiveHash(int initialCapacity,
float loadFactor)
Creates a new TPrimitiveHash instance with a prime
capacity at or near the minimum needed to hold
initialCapacity elements with load factor
loadFactor without triggering a rehash. |
|
| Method Summary | |
|---|---|
int |
capacity()
Returns the capacity of the hash table. |
protected void |
removeAt(int index)
Delete the record at index. |
protected int |
setUp(int initialCapacity)
initializes the hashtable to a prime capacity which is at least initialCapacity + 1. |
| Methods inherited from class gnu.trove.impl.hash.THash |
|---|
calculateGrownCapacity, clear, compact, computeMaxSize, computeNextAutoCompactionAmount, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, readExternal, reenableAutoCompaction, rehash, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize, writeExternal |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public transient byte[] _states
public static final byte FREE
public static final byte FULL
public static final byte REMOVED
| Constructor Detail |
|---|
public TPrimitiveHash()
THash instance with the default
capacity and load factor.
public TPrimitiveHash(int initialCapacity)
TPrimitiveHash instance with a prime
capacity at or near the specified capacity and with the default
load factor.
initialCapacity - an int value
public TPrimitiveHash(int initialCapacity,
float loadFactor)
TPrimitiveHash instance with a prime
capacity at or near the minimum needed to hold
initialCapacity elements with load factor
loadFactor without triggering a rehash.
initialCapacity - an int valueloadFactor - a float value| Method Detail |
|---|
public int capacity()
capacity in class THashprotected void removeAt(int index)
removeAt in class THashindex - an int valueprotected int setUp(int initialCapacity)
setUp in class THashinitialCapacity - an int value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||