|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--com.sosnoski.util.ObjectHashBase
|
+--com.sosnoski.util.hashmap.ObjectKeyBase
Base class for type-specific hash map classes with object keys. This
class builds on the basic structure provided by ObjectHashBase,
specializing it for the case of a hash map where data values are associated
with the keys. See the base class description for details of the
implementation.
Hash maps based on this class are unsynchronized in order to provide the best possible performance for typical usage scenarios, so explicit synchronization must be implemented by the subclass or the application in cases where they are to be modified in a multithreaded environment.
Subclasses need to implement the abstract methods defined by the base class
for working with the key array, and by this class for working with the value
array and for restructuring, as well as the actual data access methods (at
least the basic add(), containsKey(),
get(), and remove() methods).
PrimitiveKeyBase| Fields inherited from class com.sosnoski.util.ObjectHashBase |
DEFAULT_FILL, IDENTITY_COMP, IDENTITY_HASH, m_arraySize, m_entryCount, m_entryLimit, m_fillFraction, m_hitOffset, m_identCompare, m_identHash, MINIMUM_SIZE, STANDARD_HASH |
| Constructor Summary | |
ObjectKeyBase(int count,
double fill,
java.lang.Class ktype,
java.lang.Class vtype,
java.lang.Object tech)
Constructor with full specification. |
|
ObjectKeyBase(ObjectKeyBase from)
Copy (clone) constructor. |
|
| Method Summary | |
void |
clear()
Set the table to the empty state. |
protected abstract java.lang.Object |
getValueArray()
Get the backing array of values. |
protected void |
internalRemove(int slot)
Internal remove pair from the table. |
java.util.Iterator |
iterator()
Return an iterator for the key Objects in this map. |
protected void |
reallocate(int size)
Resize the base arrays after a size change. |
protected abstract boolean |
reinsert(int slot)
Reinsert an entry into the hash map. |
protected abstract void |
restructure(java.lang.Object karray,
java.lang.Object varray)
Restructure the table. |
protected abstract void |
setValueArray(java.lang.Object array)
Set the backing array of values. |
| Methods inherited from class com.sosnoski.util.ObjectHashBase |
ensureCapacity, freeSlot, getKeyArray, growCapacity, setKeyArray, size, standardFind, standardSlot, stepSlot |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ObjectKeyBase(int count,
double fill,
java.lang.Class ktype,
java.lang.Class vtype,
java.lang.Object tech)
count - number of values to assume in initial sizing of tablefill - fraction full allowed for table before growingktype - type of primitives used for keysvtype - type of primitives or objects used for valuestech - hash technique specifier (one of STANDARD_HASH,
IDENTITY_COMP, or IDENTITY_HASH, inherited from
ObjectHashBase)public ObjectKeyBase(ObjectKeyBase from)
from - instance being copied| Method Detail |
protected abstract java.lang.Object getValueArray()
protected abstract void setValueArray(java.lang.Object array)
array - backing value array object
protected abstract void restructure(java.lang.Object karray,
java.lang.Object varray)
karray - array of keysvarray - array of valuesprotected void reallocate(int size)
reallocate in class ObjectHashBasesize - new size for base arraysprotected abstract boolean reinsert(int slot)
slot - position of entry to be reinserted into hash maptrue if the slot number used by the entry has
has changed, false if notprotected void internalRemove(int slot)
null and adjusting the count
present, then chains through the table to reinsert any other pairs
which may have collided with the removed pair. If the associated value
is an object reference, it should be set to null before
this method is called.slot - index number of pair to be removedpublic void clear()
clear in class ObjectHashBasepublic final java.util.Iterator iterator()
Objects in this map. The
iterator returns all keys in arbitrary order, but is not "live". Any
changes to the map while the iteration is in progress will give
indeterminant results.
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||