public abstract class TObjectHash extends THash implements Serializable, TObjectHashingStrategy
| Modifier and Type | Field and Description |
|---|---|
protected Object[] |
_set
the set of Objects
|
protected static Object |
REMOVED |
_free, _loadFactor, _maxSize, _size, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR| Constructor and Description |
|---|
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. |
TObjectHash(int initialCapacity,
float loadFactor,
TObjectHashingStrategy strategy)
Creates a new
TObjectHash instance with a prime
value at or near the specified capacity and load factor. |
TObjectHash(int initialCapacity,
TObjectHashingStrategy strategy)
Creates a new
TObjectHash instance whose capacity
is the next highest prime above initialCapacity + 1
unless that value is already prime. |
TObjectHash(TObjectHashingStrategy strategy)
Creates a new
TObjectHash instance with the
default capacity and load factor and a custom hashing strategy. |
| Modifier and Type | Method and Description |
|---|---|
protected int |
capacity() |
Object |
clone() |
int |
computeHashCode(Object o)
This is the default implementation of TObjectHashingStrategy:
it delegates hashing to the Object's hashCode method.
|
boolean |
contains(Object obj)
Searches the set for obj
|
boolean |
equals(Object o1,
Object o2)
This is the default implementation of TObjectHashingStrategy:
it delegates equality comparisons to the first parameter's
equals() method.
|
boolean |
forEach(TObjectProcedure procedure)
Executes procedure for each element in the set.
|
protected int |
index(Object obj)
Locates the index of obj.
|
protected int |
insertionIndex(Object obj)
Locates the index at which obj can be inserted.
|
protected void |
removeAt(int index)
Delete the record at index.
|
protected int |
setUp(int initialCapacity)
initializes the Object set of this hash table.
|
clear, compact, ensureCapacity, isEmpty, postInsertHook, rehash, size, trimToSizeprotected transient Object[] _set
protected static final Object REMOVED
public TObjectHash()
TObjectHash instance with the
default capacity and load factor.public TObjectHash(TObjectHashingStrategy strategy)
TObjectHash instance with the
default capacity and load factor and a custom hashing strategy.strategy - used to compute hash codes and to compare objects.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,
TObjectHashingStrategy strategy)
TObjectHash instance whose capacity
is the next highest prime above initialCapacity + 1
unless that value is already prime. Uses the specified custom
hashing strategy.initialCapacity - an int valuestrategy - used to compute hash codes and to compare objects.public 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.public TObjectHash(int initialCapacity,
float loadFactor,
TObjectHashingStrategy strategy)
TObjectHash instance with a prime
value at or near the specified capacity and load factor. Uses
the specified custom hashing strategy.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 objects.public Object clone()
protected int capacity()
protected void removeAt(int index)
THashprotected int setUp(int initialCapacity)
public boolean forEach(TObjectProcedure procedure)
procedure - a TObjectProcedure valuepublic boolean contains(Object obj)
obj - an Object valueboolean valueprotected int index(Object obj)
obj - an Object valueprotected int insertionIndex(Object obj)
obj - an Object valuepublic final int computeHashCode(Object o)
computeHashCode in interface TObjectHashingStrategyobject - for which the hashcode is to be computedObject.hashCode()public final boolean equals(Object o1, Object o2)
equals in interface TObjectHashingStrategyo1 - an Object valueo2 - an Object valueObject.equals(Object)Copyright © 2019 JULIE Lab, Germany. All rights reserved.