Class Int2IntRBT
java.lang.Object
org.apache.uima.internal.util.rb_trees.IntArrayRBTcommon
org.apache.uima.internal.util.rb_trees.Int2IntRBT
A map<int, int>
uses IntArrayRBTcommon
Int to Int Map, based on IntArrayRBT, used in no-duplicates mode
Implements Map - like interface:
keys and values are ints
Entry set not (yet) impl
no keySet()
no values()
-
Field Summary
FieldsFields inherited from class org.apache.uima.internal.util.rb_trees.IntArrayRBTcommon
black, color, default_size, greatestNode, growth_factor, initialSize, klrp, klrp1, klrp2, klrp3, MAXklrp0, MAXklrpMask, multiplication_limit, next, NIL, red, root, size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()copy()protected voidensureCapacityKlrp(int requiredSize) There are two strategies for storing data, controlled by useklrp.protected intfindKeyFast(int k) Fast version of findKey Keeps the last node referenced *** NOT THREAD SAFE *** Tries to shorten the search path, conditionallyvoidflush()intget(int k) Get the value for a given keyintgetMostlyClose(int k) keyIterator(int aKey) keyValueIterator(int aKey) intput(int k, int v) adds a k, v pair. if k already present, replaces v. returns previous value, or 0 if no prev valueprotected voidMethods inherited from class org.apache.uima.internal.util.rb_trees.IntArrayRBTcommon
compare, contains, containsKey, deleteFixup, deleteNode, ensureArrayCapacity, findInsertionPoint, findInsertionPointCmn, findInsertionPointNoDups, findKey, findKeyDown, getFirstNode, getKeyForNode, getLeft, getParent, getRight, getXXX, initVars, leftRotate, maxDepth, maxDepth, minDepth, minDepth, newNode, nextNode, nextPowerOf2, nodeDepth, nodeDepth, previousNode, printKeys, printKeys, rightRotate, satisfiesRBProps, satisfiesRedBlackProperties, setAsRoot, setLeft, setParent, setRight, setXXX, size
-
Field Details
-
values
protected int[] values
-
-
Constructor Details
-
Int2IntRBT
public Int2IntRBT()Constructor for IntArrayRBT. -
Int2IntRBT
public Int2IntRBT(int initialSize)
-
-
Method Details
-
setupArrays
protected void setupArrays()- Overrides:
setupArraysin classIntArrayRBTcommon
-
copy
-
clear
public void clear() -
flush
public void flush()- Overrides:
flushin classIntArrayRBTcommon
-
ensureCapacityKlrp
protected void ensureCapacityKlrp(int requiredSize) Description copied from class:IntArrayRBTcommonThere are two strategies for storing data, controlled by useklrp. If useklrp, then 4 elements are put together into one int vector, taking 4 words per element. Other elements are kept in their own vectors. The growth strategy for the 4-element one is to a) start at some minimum (a power of 2) b) grow by doubling up to 2 * 1024 *1024 c) grow by adding 2 *1024 * 1024, until d) reaching the maximum size (the max index will be 1 less) e) when that size is reached, the next int[] is set up with the minimum, and it grows as above. The test for growth and growing is made individually for the different parts. For color (a boolean), the size for stopping doubling is 32 * 2 * 1024 * 1024, so the # of words is the same.- Overrides:
ensureCapacityKlrpin classIntArrayRBTcommon- Parameters:
requiredSize- -
-
get
public int get(int k) Get the value for a given key- Parameters:
k- -- Returns:
- the value
-
getMostlyClose
public int getMostlyClose(int k) -
put
public int put(int k, int v) adds a k, v pair. if k already present, replaces v. returns previous value, or 0 if no prev value- Parameters:
k- -v- -- Returns:
- previous value or 0 if key not previously present
-
findKeyFast
protected int findKeyFast(int k) Fast version of findKey Keeps the last node referenced *** NOT THREAD SAFE *** Tries to shorten the search path, conditionally- Parameters:
k- -- Returns:
- -
-
keyIterator
-
keyIterator
-
keyValueIterator
-
keyValueIterator
-