Package org.apache.uima.internal.util
Class Obj2IntIdentityHashMap<T>
java.lang.Object
org.apache.uima.internal.util.Common_hash_support
org.apache.uima.internal.util.Obj2IntIdentityHashMap<T>
A Map from non-null Objects of type T to ints int value 0 reserved to mean object is not in the
table.
This impl is for use in a single thread case only, for table updates Multiple reader threads are
OK if there's no writing.
Supports shrinking (reallocating the big table)
Removed objects replaced with special marker object in the table so find operations continue to
work (they can't stop upon finding this object).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.uima.internal.util.Common_hash_support
Common_hash_support.CommonCopyOld2New, Common_hash_support.CommonKeyIterator -
Field Summary
Fields inherited from class org.apache.uima.internal.util.Common_hash_support
found_removed, histogram, initialCapacity, loadFactor, maxProbe, MIN_CAPACITY, MIN_CAPACITY_SHRINK, MIN_SIZE, removed, secondTimeShrinkable, sizeWhichTriggersExpansion, TUNE -
Constructor Summary
ConstructorsConstructorDescriptionObj2IntIdentityHashMap(int initialCapacity, Class<T> clazz, T removedMarker) Obj2IntIdentityHashMap(Class<T> clazz, T removedMarker) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbooleanprotected voidcopy_to_new_table(int newCapacity, int oldCapacity, Common_hash_support.CommonCopyOld2New commonCopy) intintT[]getKeys()protected booleanis_valid_key(int pos) iterator()protected intprotected voidnewKeysAndValues(int capacity) intintCan't replace the item with a null because other keys that were stored in the table which previously collided with the removed item won't be found.toString()Methods inherited from class org.apache.uima.internal.util.Common_hash_support
clear, commonPutOrAddNotFound, commonRemove, debugValidate, findPosition, incrementSize, moveToNextFilled, moveToPreviousFilled, newTable, resetHistogram, showHistogram, size, tableSpace
-
Constructor Details
-
Obj2IntIdentityHashMap
-
Obj2IntIdentityHashMap
- Parameters:
initialCapacity- - you can add this many before expansionclazz- - a superclass of the stored itemsremovedMarker- - a unique value never stored in the table, used to mark removed items
-
-
Method Details
-
contains
-
find
- Parameters:
obj- the object to find in the table (if it is there)- Returns:
- the position of obj in the table, or -1 if not in the table
-
get
-
put
- Parameters:
obj- the keyvalue- the value- Returns:
- the previous value, or 0 if this map did not already contain the specified key
-
remove
Can't replace the item with a null because other keys that were stored in the table which previously collided with the removed item won't be found. UIMA-4204- Parameters:
rawKey- the value to remove- Returns:
- the value previously associated with the key, or 0 if none
-
getKeys
-
iterator
-
toString
-
is_valid_key
protected boolean is_valid_key(int pos) - Specified by:
is_valid_keyin classCommon_hash_support
-
keys_length
protected int keys_length()- Specified by:
keys_lengthin classCommon_hash_support
-
newKeysAndValues
protected void newKeysAndValues(int capacity) - Specified by:
newKeysAndValuesin classCommon_hash_support
-
clearKeysAndValues
protected void clearKeysAndValues()- Specified by:
clearKeysAndValuesin classCommon_hash_support
-
copy_to_new_table
protected void copy_to_new_table(int newCapacity, int oldCapacity, Common_hash_support.CommonCopyOld2New commonCopy) - Specified by:
copy_to_new_tablein classCommon_hash_support
-