|
||||||
| 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.hashset.PrimitiveSetBase
|
+--com.sosnoski.util.hashset.IntHashSet
Hash set using 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 hash set implementation.
| Field Summary | |
protected int[] |
m_keyTable
Array of key table slots. |
| 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 | |
IntHashSet()
Default constructor. |
|
IntHashSet(int count)
Constructor with only size supplied. |
|
IntHashSet(int count,
double fill)
Constructor with full specification. |
|
IntHashSet(IntHashSet base)
Copy (clone) constructor. |
|
| Method Summary | |
boolean |
add(int key)
Add a key to the set. |
protected int |
assignSlot(int key)
Assign slot for key. |
java.lang.Object |
clone()
Construct a copy of the table. |
protected int |
computeSlot(int key)
Compute the base slot for a key. |
boolean |
contains(int key)
Check if a key is present in the table. |
protected java.lang.Object |
getKeyArray()
Get the backing array of keys. |
protected int |
internalFind(int key)
Internal find key in table. |
protected boolean |
reinsert(int slot)
Reinsert a key into the hash map. |
boolean |
remove(int key)
Remove a key from the table. |
protected void |
restructure(boolean[] flags,
java.lang.Object karray)
Restructure the table. |
protected void |
setKeyArray(java.lang.Object array)
Set the backing array of keys. |
| Methods inherited from class com.sosnoski.util.hashset.PrimitiveSetBase |
reallocate |
| Methods inherited from class com.sosnoski.util.PrimitiveHashBase |
clear, ensureCapacity, freeSlot, growCapacity, size, stepSlot |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int[] m_keyTable
| Constructor Detail |
public IntHashSet(int count,
double fill)
count - number of values to assume in initial sizing of tablefill - fraction full allowed for table before growingpublic IntHashSet(int count)
count - number of values to assume in initial sizing of tablepublic IntHashSet()
public IntHashSet(IntHashSet base)
base - instance being copied| Method Detail |
protected java.lang.Object getKeyArray()
getKeyArray in class PrimitiveHashBaseprotected void setKeyArray(java.lang.Object array)
setKeyArray in class PrimitiveHashBasearray - backing key array objectprotected final boolean reinsert(int slot)
slot - position of key to be reinserted into hash maptrue if the slot number used by the key has
has changed, false if not
protected void restructure(boolean[] flags,
java.lang.Object karray)
restructure in class PrimitiveSetBaseflags - array of flags for array slots usedkarray - array of keysprotected final int computeSlot(int key)
key - key value to be computedprotected int assignSlot(int key)
key - key to be added to tablepublic boolean add(int key)
key - key to be added to settrue if key added to set, false if
already present in setprotected final int internalFind(int key)
key - to be found in table-index-1 of slot to be
used for inserting key in table if not already present (always negative)public boolean contains(int key)
key - key to be foundtrue if key found in table, false
if notpublic boolean remove(int key)
key - key to be removed from tabletrue if key successfully removed from set,
false if key not found in setpublic 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 | |||||