|
||||||
| 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
|
+--com.sosnoski.util.hashmap.ObjectObjectHashMap
Hash map using Object values as keys mapped to
Object values. This implementation is unsynchronized
in order to provide the best possible performance for typical usage
scenarios, so explicit synchronization must be implemented by a wrapper
class or directly by the application in cases where instances are modified
in a multithreaded environment. See the base classes for other details of
the implementation.
| Field Summary | |
protected java.lang.Object[] |
m_keyTable
Array of key table slots. |
protected java.lang.Object[] |
m_valueTable
Array of value table slots. |
| 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 | |
ObjectObjectHashMap()
Default constructor. |
|
ObjectObjectHashMap(int count)
Constructor with only size supplied. |
|
ObjectObjectHashMap(int count,
double fill)
Constructor with size and fill fraction specified. |
|
ObjectObjectHashMap(int count,
double fill,
java.lang.Object tech)
Constructor with full specification. |
|
ObjectObjectHashMap(int count,
java.lang.Object tech)
Constructor with only size and hash technique supplied. |
|
ObjectObjectHashMap(java.lang.Object tech)
Constructor with technique specified. |
|
ObjectObjectHashMap(ObjectObjectHashMap base)
Copy (clone) constructor. |
|
| Method Summary | |
java.lang.Object |
add(java.lang.Object key,
java.lang.Object value)
Add an entry to the table. |
protected int |
assignSlot(java.lang.Object key,
java.lang.Object value)
Assign slot for entry. |
java.lang.Object |
clone()
Construct a copy of the table. |
boolean |
containsKey(java.lang.Object key)
Check if an entry is present in the table. |
java.lang.Object |
get(java.lang.Object key)
Find an entry in the table. |
protected java.lang.Object[] |
getKeyArray()
Get the backing array of keys. |
protected java.lang.Object |
getValueArray()
Get the backing array of values. |
protected boolean |
reinsert(int slot)
Reinsert an entry into the hash map. |
java.lang.Object |
remove(java.lang.Object key)
Remove an entry from the table. |
protected void |
restructure(java.lang.Object karray,
java.lang.Object varray)
Restructure the table. |
protected void |
setKeyArray(java.lang.Object array)
Set the backing array of keys. |
protected void |
setValueArray(java.lang.Object array)
Set the backing array of values. |
java.util.Iterator |
valueIterator()
Return an iterator for the value Objects in this map. |
| Methods inherited from class com.sosnoski.util.hashmap.ObjectKeyBase |
clear, internalRemove, iterator, reallocate |
| Methods inherited from class com.sosnoski.util.ObjectHashBase |
ensureCapacity, freeSlot, growCapacity, size, standardFind, standardSlot, stepSlot |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.Object[] m_keyTable
protected java.lang.Object[] m_valueTable
| Constructor Detail |
public ObjectObjectHashMap(int count,
double fill,
java.lang.Object tech)
count - number of values to assume in initial sizing of tablefill - fraction full allowed for table before growingtech - hash technique specifier (one of STANDARD_HASH,
IDENTITY_COMP, or IDENTITY_HASH, inherited from
ObjectHashBase)
public ObjectObjectHashMap(int count,
double fill)
count - number of values to assume in initial sizing of tablefill - fraction full allowed for table before growing
public ObjectObjectHashMap(int count,
java.lang.Object tech)
count - number of values to assume in initial sizing of tabletech - hash technique specifier (one of STANDARD_HASH,
IDENTITY_COMP, or IDENTITY_HASH, inherited from
ObjectHashBase)public ObjectObjectHashMap(int count)
count - number of values to assume in initial sizing of tablepublic ObjectObjectHashMap(java.lang.Object tech)
tech - hash technique specifier (one of STANDARD_HASH,
IDENTITY_COMP, or IDENTITY_HASH, inherited from
ObjectHashBase)public ObjectObjectHashMap()
public ObjectObjectHashMap(ObjectObjectHashMap base)
base - instance being copied| Method Detail |
protected final java.lang.Object[] getKeyArray()
getKeyArray in class ObjectHashBaseprotected final void setKeyArray(java.lang.Object array)
setKeyArray in class ObjectHashBasearray - backing key array objectprotected final java.lang.Object getValueArray()
getValueArray in class ObjectKeyBaseprotected final void setValueArray(java.lang.Object array)
setValueArray in class ObjectKeyBasearray - backing value array objectprotected final boolean reinsert(int slot)
reinsert in class ObjectKeyBaseslot - position of entry to be reinserted into hash maptrue if the slot number used by the entry has
has changed, false if not
protected void restructure(java.lang.Object karray,
java.lang.Object varray)
restructure in class ObjectKeyBasekarray - array of keysvarray - array of values
protected int assignSlot(java.lang.Object key,
java.lang.Object value)
key - to be added to tablevalue - associated value for key
public java.lang.Object add(java.lang.Object key,
java.lang.Object value)
key - key to be added to table (non-null)value - associated value for key (non-null)null
if key not previously present in tablepublic final boolean containsKey(java.lang.Object key)
key - key for entry to be foundtrue if key found in table, false
if notpublic final java.lang.Object get(java.lang.Object key)
key - key for entry to be returnednull if key not foundpublic java.lang.Object remove(java.lang.Object key)
key - key to be removed from tablenull
if key not found in tablepublic final java.util.Iterator valueIterator()
Objects in this map. The
iterator returns all values in arbitrary order, but is not "live". Any
changes to the map while the iteration is in progress will give
indeterminant results.public java.lang.Object clone()
clone in class java.lang.Object
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||