|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--com.sosnoski.util.PrimitiveHashBase
|
+--com.sosnoski.util.hashmap.PrimitiveKeyBase
Base class for type-specific hash map classes with primitive keys. This
class builds on the basic structure provided by
PrimitiveHashBase, specializing it for the case of a hash map
where a data value is associated with each key. See the base class
description for details of the implementation.
Hash sets 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).
PrimitiveHashBase| Fields inherited from class com.sosnoski.util.PrimitiveHashBase |
DEFAULT_FILL, KEY_MULTIPLIER, m_entryCount, m_entryLimit, m_fillFraction, m_flagTable, m_hitOffset, MINIMUM_SIZE |
| Constructor Summary | |
PrimitiveKeyBase(int count,
double fill,
java.lang.Class ktype,
java.lang.Class vtype)
Constructor with full specification. |
|
PrimitiveKeyBase(PrimitiveKeyBase base)
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 |
reallocate(int size)
Resize the base arrays after a size change. |
protected abstract void |
restructure(boolean[] flags,
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.PrimitiveHashBase |
ensureCapacity, freeSlot, getKeyArray, growCapacity, setKeyArray, size, stepSlot |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PrimitiveKeyBase(int count,
double fill,
java.lang.Class ktype,
java.lang.Class vtype)
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 valuespublic PrimitiveKeyBase(PrimitiveKeyBase base)
base - 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(boolean[] flags,
java.lang.Object karray,
java.lang.Object varray)
flags - array of flags for array slots usedkarray - array of keysvarray - array of valuesprotected void reallocate(int size)
reallocate in class PrimitiveHashBasesize - new size for base arrayspublic void clear()
clear in class PrimitiveHashBase
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||