|
||||||
| 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.hashset.ObjectSetBase
Base class for type-specific hash set classes with object keys. This
class builds on the basic structure provided by ObjectHashBase,
specializing it for the case of a hash set where the keys are the only data.
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 the abstract restructuring method
defined by this class, as well as the actual data access methods (at least
the basic add, contains, and remove
methods).
| 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 | |
ObjectSetBase(int count,
double fill,
java.lang.Class type,
java.lang.Object tech)
Constructor with full specification. |
|
ObjectSetBase(ObjectSetBase base)
Copy (clone) constructor. |
|
| Method Summary | |
protected void |
internalRemove(int slot)
Internal remove item from the table. |
java.util.Iterator |
iterator()
Return an iterator for the Objects in this set. |
protected void |
reallocate(int size)
Resize the base array after a size change. |
protected abstract boolean |
reinsert(int slot)
Reinsert an entry into the table. |
protected abstract void |
restructure(java.lang.Object karray)
Restructure the table. |
| Methods inherited from class com.sosnoski.util.ObjectHashBase |
clear, 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 ObjectSetBase(int count,
double fill,
java.lang.Class type,
java.lang.Object tech)
count - number of values to assume in initial sizing of tablefill - fraction full allowed for table before growingtype - type of objects contained in tabletech - hash technique specifier (one of STANDARD_HASH,
IDENTITY_COMP, or IDENTITY_HASH, inherited from
ObjectSetBase)public ObjectSetBase(ObjectSetBase base)
base - instance being copied| Method Detail |
protected abstract boolean reinsert(int slot)
slot - position of entry to be reinserted into tabletrue if the slot number used by the entry has
has changed, false if notprotected abstract void restructure(java.lang.Object karray)
karray - array of keysprotected void reallocate(int size)
reallocate in class ObjectHashBasesize - new size for base arraysprotected void internalRemove(int slot)
null and adjusting the count
present, then chains through the table to reinsert any other items
which may have collided with the removed item.slot - index number of item to be removedpublic final java.util.Iterator iterator()
Objects in this set. The
iterator returns all items in arbitrary order, but is not "live". Any
changes to the set 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 | |||||