Package org.apache.uima.internal.util
Class Common_hash_support
java.lang.Object
org.apache.uima.internal.util.Common_hash_support
- Direct Known Subclasses:
Int2ObjHashMap
,IntHashSet
,Obj2IntIdentityHashMap
,ObjHashSet
A common superclass for hash maps and hash sets
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
protected class
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
set to the first found_removed when searchingprotected int[]
protected final int
protected final float
protected int
protected static final int
protected static final int
protected static final int
protected int
protected boolean
protected int
protected static final boolean
-
Constructor Summary
ConstructorDescriptionCommon_hash_support
(int initialSizeBeforeExpanding) Common_hash_support
(int initialSizeBeforeExpanding, float factor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
protected abstract void
protected void
protected void
only called if actually found and removed an entryprotected abstract void
copy_to_new_table
(int new_capacity, int old_capacity, Common_hash_support.CommonCopyOld2New r) protected void
protected int
findPosition
(int hash, IntPredicate is_eq_or_not_present, IntPredicate is_removed_key) It gets a ref to the current value of table, and then searches that array.protected void
protected abstract boolean
is_valid_key
(int pos) protected abstract int
protected int
moveToNextFilled
(int pos) advance pos until it points to a non 0 or is 1 past end If pos is negative, start at 0.protected int
moveToPreviousFilled
(int pos) decrement pos until it points to a non 0 or is -1 If pos is beyond end start at end.protected abstract void
newKeysAndValues
(int capacity) protected void
newTable
(int capacity) protected void
void
int
size()
static int
tableSpace
(int numberOfElements, Float factor)
-
Field Details
-
TUNE
protected static final boolean TUNE- See Also:
-
MIN_SIZE
protected static final int MIN_SIZE- See Also:
-
MIN_CAPACITY
protected static final int MIN_CAPACITY- See Also:
-
MIN_CAPACITY_SHRINK
protected static final int MIN_CAPACITY_SHRINK- See Also:
-
loadFactor
protected final float loadFactor -
initialCapacity
protected final int initialCapacity -
histogram
protected int[] histogram -
maxProbe
protected int maxProbe -
sizeWhichTriggersExpansion
protected int sizeWhichTriggersExpansion -
removed
protected int removed -
found_removed
protected int found_removedset to the first found_removed when searching -
secondTimeShrinkable
protected boolean secondTimeShrinkable
-
-
Constructor Details
-
Common_hash_support
public Common_hash_support(int initialSizeBeforeExpanding) - Parameters:
initialSizeBeforeExpanding
- the number of elements the table should hold before expanding
-
Common_hash_support
public Common_hash_support(int initialSizeBeforeExpanding, float factor) -
Common_hash_support
-
-
Method Details
-
clear
public void clear() -
findPosition
protected int findPosition(int hash, IntPredicate is_eq_or_not_present, IntPredicate is_removed_key) It gets a ref to the current value of table, and then searches that array. Side effect: found_removed is set to the position of the first REMOVED_KEY (if any) encountered during the search.- Parameters:
hash
- the hash code of the keyis_eq_or_not_present
- true if the key at the int position is == to the key, or is 0is_removed_key
- true if the key at the int position is "removed"- Returns:
- the probeAddr in keys array. The value is the not-present-value if not found
-
moveToNextFilled
protected int moveToNextFilled(int pos) advance pos until it points to a non 0 or is 1 past end If pos is negative, start at 0. Don't move if pos already has valid key- Parameters:
pos
- -- Returns:
- updated pos
-
moveToPreviousFilled
protected int moveToPreviousFilled(int pos) decrement pos until it points to a non 0 or is -1 If pos is beyond end start at end. Don't move if pos already has valid key- Parameters:
pos
- -- Returns:
- updated pos
-
newTable
protected void newTable(int capacity) -
incrementSize
protected void incrementSize() -
commonPutOrAddNotFound
protected void commonPutOrAddNotFound() -
commonRemove
protected void commonRemove()only called if actually found and removed an entry -
size
public int size() -
is_valid_key
protected abstract boolean is_valid_key(int pos) -
keys_length
protected abstract int keys_length() -
newKeysAndValues
protected abstract void newKeysAndValues(int capacity) -
clearKeysAndValues
protected abstract void clearKeysAndValues() -
copy_to_new_table
protected abstract void copy_to_new_table(int new_capacity, int old_capacity, Common_hash_support.CommonCopyOld2New r) -
resetHistogram
protected void resetHistogram() -
showHistogram
public void showHistogram() -
tableSpace
- Parameters:
numberOfElements
- -factor
- -- Returns:
- capacity of the main table (either 2 byte or 4 byte entries)
-
debugValidate
protected void debugValidate()
-