|
||||||
| 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.ObjectIntHashMap
Hash map using Object values as keys mapped to primitive
int 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 | |
static int |
DEFAULT_NOT_FOUND
Default value returned when key not found in table. |
protected java.lang.Object[] |
m_keyTable
Array of key table slots. |
protected int |
m_notFoundValue
Value returned when key not found in table. |
protected int[] |
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 | |
ObjectIntHashMap()
Default constructor. |
|
ObjectIntHashMap(int count)
Constructor with only size supplied. |
|
ObjectIntHashMap(int count,
double fill)
Constructor with size and fill fraction specified. |
|
ObjectIntHashMap(int count,
double fill,
int miss,
java.lang.Object tech)
Constructor with full specification. |
|
ObjectIntHashMap(int count,
java.lang.Object tech)
Constructor with only size and hash technique supplied. |
|
ObjectIntHashMap(java.lang.Object tech)
Constructor with hash technique specified. |
|
ObjectIntHashMap(ObjectIntHashMap base)
Copy (clone) constructor. |
|
| Method Summary | |
int |
add(java.lang.Object key,
int value)
Add an entry to the table. |
protected int |
assignSlot(java.lang.Object key,
int 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. |
int |
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. |
int |
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. |
| 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 |
public static final int DEFAULT_NOT_FOUND
protected java.lang.Object[] m_keyTable
protected int[] m_valueTable
protected int m_notFoundValue
| Constructor Detail |
public ObjectIntHashMap(int count,
double fill,
int miss,
java.lang.Object tech)
count - number of values to assume in initial sizing of tablefill - fraction full allowed for table before growingmiss - value returned when key not found in tabletech - hash technique specifier (one of STANDARD_HASH,
IDENTITY_COMP, or IDENTITY_HASH, inherited from
ObjectHashBase)
public ObjectIntHashMap(int count,
double fill)
count - number of values to assume in initial sizing of tablefill - fraction full allowed for table before growing
public ObjectIntHashMap(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 ObjectIntHashMap(int count)
count - number of values to assume in initial sizing of tablepublic ObjectIntHashMap(java.lang.Object tech)
tech - hash technique specifier (one of STANDARD_HASH,
IDENTITY_COMP, or IDENTITY_HASH, inherited from
ObjectHashBase)public ObjectIntHashMap()
public ObjectIntHashMap(ObjectIntHashMap 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,
int value)
key - to be added to tablevalue - associated value for key
public int add(java.lang.Object key,
int value)
key - key to be added to table (non-null)value - associated value for keypublic final boolean containsKey(java.lang.Object key)
key - key for entry to be foundtrue if key found in table, false
if notpublic final int get(java.lang.Object key)
key - key for entry to be returnedpublic int remove(java.lang.Object key)
key - key to be removed from tablepublic 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 | |||||