|
||||||||||
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.TObjectHash<T>
public abstract class TObjectHash<T>
An open addressed hashing implementation for Object types.
Created: Sun Nov 4 08:56:06 2001
Field Summary | |
---|---|
java.lang.Object[] |
_set
the set of Objects |
static java.lang.Object |
FREE
|
static java.lang.Object |
REMOVED
|
Fields inherited from class gnu.trove.impl.hash.THash |
---|
_autoCompactionFactor, _autoCompactRemovesRemaining, _autoCompactTemporaryDisable, _free, _loadFactor, _maxSize, _size, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR |
Constructor Summary | |
---|---|
TObjectHash()
Creates a new TObjectHash instance with the
default capacity and load factor. |
|
TObjectHash(int initialCapacity)
Creates a new TObjectHash instance whose capacity
is the next highest prime above initialCapacity + 1
unless that value is already prime. |
|
TObjectHash(int initialCapacity,
float loadFactor)
Creates a new TObjectHash instance with a prime
value at or near the specified capacity and load factor. |
Method Summary | |
---|---|
int |
capacity()
|
boolean |
contains(java.lang.Object obj)
Searches the set for obj |
boolean |
forEach(TObjectProcedure<T> procedure)
Executes procedure for each element in the set. |
protected int |
index(java.lang.Object obj)
Locates the index of obj. |
protected int |
insertionIndex(T obj)
Locates the index at which obj can be inserted. |
void |
readExternal(java.io.ObjectInput in)
|
protected void |
removeAt(int index)
Delete the record at index. |
int |
setUp(int initialCapacity)
initializes the Object set of this hash table. |
protected void |
throwObjectContractViolation(java.lang.Object o1,
java.lang.Object o2)
Convenience methods for subclasses to use in throwing exceptions about badly behaved user objects employed as keys. |
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class gnu.trove.impl.hash.THash |
---|
calculateGrownCapacity, clear, compact, computeMaxSize, computeNextAutoCompactionAmount, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, reenableAutoCompaction, rehash, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public transient java.lang.Object[] _set
public static final java.lang.Object REMOVED
public static final java.lang.Object FREE
Constructor Detail |
---|
public TObjectHash()
TObjectHash
instance with the
default capacity and load factor.
public TObjectHash(int initialCapacity)
TObjectHash
instance whose capacity
is the next highest prime above initialCapacity + 1
unless that value is already prime.
initialCapacity
- an int
valuepublic TObjectHash(int initialCapacity, float loadFactor)
TObjectHash
instance with a prime
value at or near the specified capacity and load factor.
initialCapacity
- used to find a prime capacity for the table.loadFactor
- used to calculate the threshold over which
rehashing takes place.Method Detail |
---|
public int capacity()
capacity
in class THash
protected void removeAt(int index)
THash
removeAt
in class THash
index
- an int
valuepublic int setUp(int initialCapacity)
setUp
in class THash
initialCapacity
- an int
value
int
valuepublic boolean forEach(TObjectProcedure<T> procedure)
procedure
- a TObjectProcedure
value
public boolean contains(java.lang.Object obj)
obj
- an Object
value
boolean
valueprotected int index(java.lang.Object obj)
obj
- an Object
value
protected int insertionIndex(T obj)
obj
- an Object
value
protected final void throwObjectContractViolation(java.lang.Object o1, java.lang.Object o2) throws java.lang.IllegalArgumentException
o1
- the first of the equal elements with unequal hash codes.o2
- the second of the equal elements with unequal hash codes.
java.lang.IllegalArgumentException
- the whole point of this method.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class THash
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class THash
java.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |