|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.elasticsearch.util.gnu.trove.THash org.elasticsearch.util.gnu.trove.TPrimitiveHash org.elasticsearch.util.gnu.trove.TShortHash
public abstract class TShortHash
An open addressed hashing implementation for short primitives.
Created: Sun Nov 4 08:56:06 2001
Field Summary | |
---|---|
protected TShortHashingStrategy |
_hashingStrategy
strategy used to hash values in this collection |
protected short[] |
_set
the set of shorts |
Fields inherited from class org.elasticsearch.util.gnu.trove.TPrimitiveHash |
---|
_states, FREE, FULL, REMOVED |
Fields inherited from class org.elasticsearch.util.gnu.trove.THash |
---|
_autoCompactionFactor, _autoCompactRemovesRemaining, _free, _loadFactor, _maxSize, _size, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR |
Constructor Summary | |
---|---|
TShortHash()
Creates a new TShortHash instance with the default
capacity and load factor. |
|
TShortHash(int initialCapacity)
Creates a new TShortHash instance whose capacity
is the next highest prime above initialCapacity + 1
unless that value is already prime. |
|
TShortHash(int initialCapacity,
float loadFactor)
Creates a new TShortHash instance with a prime
value at or near the specified capacity and load factor. |
|
TShortHash(int initialCapacity,
float loadFactor,
TShortHashingStrategy strategy)
Creates a new TShortHash instance with a prime
value at or near the specified capacity and load factor. |
|
TShortHash(int initialCapacity,
TShortHashingStrategy strategy)
Creates a new TShortHash instance whose capacity
is the next highest prime above initialCapacity + 1
unless that value is already prime. |
|
TShortHash(TShortHashingStrategy strategy)
Creates a new TShortHash instance with the default
capacity and load factor. |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
int |
computeHashCode(short val)
Default implementation of TShortHashingStrategy: delegates hashing to HashFunctions.hash(short). |
boolean |
contains(short val)
Searches the set for val |
boolean |
forEach(TShortProcedure procedure)
Executes procedure for each element in the set. |
protected int |
index(short val)
Locates the index of val. |
protected int |
insertionIndex(short val)
Locates the index at which val can be inserted. |
protected void |
removeAt(int index)
Releases the element currently stored at index. |
protected int |
setUp(int initialCapacity)
initializes the hashtable to a prime capacity which is at least initialCapacity + 1. |
Methods inherited from class org.elasticsearch.util.gnu.trove.TPrimitiveHash |
---|
capacity |
Methods inherited from class org.elasticsearch.util.gnu.trove.THash |
---|
calculateGrownCapacity, clear, compact, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, readExternal, reenableAutoCompaction, rehash, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize, writeExternal |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient short[] _set
protected TShortHashingStrategy _hashingStrategy
Constructor Detail |
---|
public TShortHash()
TShortHash
instance with the default
capacity and load factor.
public TShortHash(int initialCapacity)
TShortHash
instance whose capacity
is the next highest prime above initialCapacity + 1
unless that value is already prime.
initialCapacity
- an int
valuepublic TShortHash(int initialCapacity, float loadFactor)
TShortHash
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.public TShortHash(TShortHashingStrategy strategy)
TShortHash
instance with the default
capacity and load factor.
strategy
- used to compute hash codes and to compare keys.public TShortHash(int initialCapacity, TShortHashingStrategy strategy)
TShortHash
instance whose capacity
is the next highest prime above initialCapacity + 1
unless that value is already prime.
initialCapacity
- an int
valuestrategy
- used to compute hash codes and to compare keys.public TShortHash(int initialCapacity, float loadFactor, TShortHashingStrategy strategy)
TShortHash
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.strategy
- used to compute hash codes and to compare keys.Method Detail |
---|
public java.lang.Object clone()
clone
in class TPrimitiveHash
protected int setUp(int initialCapacity)
setUp
in class TPrimitiveHash
initialCapacity
- an int
value
public boolean contains(short val)
val
- an short
value
boolean
valuepublic boolean forEach(TShortProcedure procedure)
procedure
- a TObjectProcedure
value
protected void removeAt(int index)
removeAt
in class TPrimitiveHash
index
- an int
valueprotected int index(short val)
val
- an short
value
protected int insertionIndex(short val)
val
- an short
value
int
valuepublic final int computeHashCode(short val)
computeHashCode
in interface TShortHashingStrategy
val
- the value to hash
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |