gnu.trove.impl.hash
Class TPrimitiveHash
- java.lang.Object
-
- gnu.trove.impl.hash.THash
-
- gnu.trove.impl.hash.TPrimitiveHash
-
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable
- Direct Known Subclasses:
- TByteByteHash, TByteCharHash, TByteDoubleHash, TByteFloatHash, TByteHash, TByteIntHash, TByteLongHash, TByteShortHash, TCharByteHash, TCharCharHash, TCharDoubleHash, TCharFloatHash, TCharHash, TCharIntHash, TCharLongHash, TCharShortHash, TDoubleByteHash, TDoubleCharHash, TDoubleDoubleHash, TDoubleFloatHash, TDoubleHash, TDoubleIntHash, TDoubleLongHash, TDoubleShortHash, TFloatByteHash, TFloatCharHash, TFloatDoubleHash, TFloatFloatHash, TFloatHash, TFloatIntHash, TFloatLongHash, TFloatShortHash, TIntByteHash, TIntCharHash, TIntDoubleHash, TIntFloatHash, TIntHash, TIntIntHash, TIntLongHash, TIntShortHash, TLongByteHash, TLongCharHash, TLongDoubleHash, TLongFloatHash, TLongHash, TLongIntHash, TLongLongHash, TLongShortHash, TShortByteHash, TShortCharHash, TShortDoubleHash, TShortFloatHash, TShortHash, TShortIntHash, TShortLongHash, TShortShortHash
public abstract class TPrimitiveHash extends THash
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.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description byte[]_statesflags indicating whether each position in the hash is FREE, FULL, or REMOVEDstatic byteFREEflag indicating that a slot in the hashtable is availablestatic byteFULLflag indicating that a slot in the hashtable is occupiedstatic byteREMOVEDflag indicating that the value of a slot in the hashtable was deleted
-
Constructor Summary
Constructors Constructor and Description TPrimitiveHash()Creates a newTHashinstance with the default capacity and load factor.TPrimitiveHash(int initialCapacity)Creates a newTPrimitiveHashinstance with a prime capacity at or near the specified capacity and with the default load factor.TPrimitiveHash(int initialCapacity, float loadFactor)Creates a newTPrimitiveHashinstance with a prime capacity at or near the minimum needed to hold initialCapacity elements with load factor loadFactor without triggering a rehash.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcapacity()Returns the capacity of the hash table.-
Methods inherited from class gnu.trove.impl.hash.THash
clear, compact, ensureCapacity, getAutoCompactionFactor, isEmpty, readExternal, reenableAutoCompaction, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize, writeExternal
-
-
-
-
Field Detail
-
_states
public transient byte[] _states
flags indicating whether each position in the hash is FREE, FULL, or REMOVED
-
FREE
public static final byte FREE
flag indicating that a slot in the hashtable is available- See Also:
- Constant Field Values
-
FULL
public static final byte FULL
flag indicating that a slot in the hashtable is occupied- See Also:
- Constant Field Values
-
REMOVED
public static final byte REMOVED
flag indicating that the value of a slot in the hashtable was deleted- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TPrimitiveHash
public TPrimitiveHash()
Creates a newTHashinstance with the default capacity and load factor.
-
TPrimitiveHash
public TPrimitiveHash(int initialCapacity)
Creates a newTPrimitiveHashinstance with a prime capacity at or near the specified capacity and with the default load factor.- Parameters:
initialCapacity- anintvalue
-
TPrimitiveHash
public TPrimitiveHash(int initialCapacity, float loadFactor)Creates a newTPrimitiveHashinstance with a prime capacity at or near the minimum needed to hold initialCapacity elements with load factor loadFactor without triggering a rehash.- Parameters:
initialCapacity- anintvalueloadFactor- afloatvalue
-
-
DataMelt 3.0 © DataMelt by jWork.ORG