public abstract class TObjectHash<T> extends THash
| Modifier and Type | Field and Description |
|---|---|
Object |
_set
the set of Objects
|
protected boolean |
consumeFreeSlot
Indicates whether the last insertKey() call used a FREE slot.
|
static Object |
FREE
|
static Object |
REMOVED
|
_autoCompactionFactor, _autoCompactRemovesRemaining, _autoCompactTemporaryDisable, _free, _loadFactor, _maxSize, _size, DEFAULT_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.
|
| Modifier and Type | Method and Description |
|---|---|
protected IllegalArgumentException |
buildObjectContractViolation(Object
Convenience methods for subclasses to use in throwing exceptions about badly behaved user objects employed as keys.
|
int |
capacity()
|
boolean |
contains(Object
Searches the set for
obj
|
protected String |
dumpExtraInfo(Object
|
protected boolean |
equals(Object
|
boolean |
forEach(TObjectProcedure
Executes
procedure for each element in the set.
|
protected int |
hash(Object
|
protected int |
index(Object
Locates the index of
obj.
|
protected int |
insertionIndex(T obj)
Deprecated.
use
insertKey(T) instead
|
protected int |
insertKey(T key)
Locates the index at which
key can be inserted.
|
protected static String |
objectInfo(Object
|
void |
readExternal(ObjectInput
|
protected void |
removeAt(int index)
Delete the record at
index.
|
protected static String |
reportPotentialConcurrentMod(int newSize, int oldSize)
|
int |
setUp(int initialCapacity)
initializes the Object set of this hash table.
|
protected void |
throwObjectContractViolation(Object
Convenience methods for subclasses to use in throwing exceptions about badly behaved user objects employed as keys.
|
protected void |
throwObjectContractViolation(Object
Convenience methods for subclasses to use in throwing exceptions about badly behaved user objects employed as keys.
|
void |
writeExternal(ObjectOutput
|
calculateGrownCapacity, clear, compact, computeMaxSize, computeNextAutoCompactionAmount, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, reenableAutoCompaction, rehash, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSizepublic transient Object[] _set
public static final ObjectREMOVED
public static final ObjectFREE
protected boolean consumeFreeSlot
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 value
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 int capacity()
protected void removeAt(int index)
THash
public int setUp(int initialCapacity)
public boolean forEach(TObjectProcedure<? super T> procedure)
procedure - a
TObjectProcedure value
public boolean contains(Objectobj)
obj - an
Object value
boolean value
protected int index(Objectobj)
obj - an
Object value
@Deprecated protected int insertionIndex(T obj)
insertKey(T) instead
obj -
protected int insertKey(T key)
key - an
Object value
protected final void throwObjectContractViolation(Objecto1, Object o2) throws IllegalArgumentException
o1 - the first of the equal elements with unequal hash codes.
o2 - the second of the equal elements with unequal hash codes.
IllegalArgumentException - the whole point of this method.
protected final void throwObjectContractViolation(Objecto1, Object o2, int size, int oldSize, Object [] oldKeys) throws IllegalArgumentException
o1 - the first of the equal elements with unequal hash codes.
o2 - the second of the equal elements with unequal hash codes.
size -
oldSize -
oldKeys - @throws IllegalArgumentException the whole point of this method.
IllegalArgumentException
protected final IllegalArgumentExceptionbuildObjectContractViolation(Object o1, Object o2, String extra)
o1 - the first of the equal elements with unequal hash codes.
o2 - the second of the equal elements with unequal hash codes.
IllegalArgumentException - the whole point of this method.
protected int hash(Objectnotnull)
protected static StringreportPotentialConcurrentMod(int newSize, int oldSize)
protected StringdumpExtraInfo(Object newVal, Object oldVal, int currentSize, int oldSize, Object [] oldKeys)
newVal - the key being inserted
oldVal - the key already stored at that position
currentSize - size of the key set during rehashing
oldSize - size of the key set before rehashing
oldKeys - the old key set
public void writeExternal(ObjectOutputout) throws IOException
writeExternal in interface
Externalizable
writeExternal in class
THash
IOException
public void readExternal(ObjectInputin) throws IOException , ClassNotFoundException
readExternal in interface
Externalizable
readExternal in class
THash
IOException
ClassNotFoundException