Class Int2IntRBT
- java.lang.Object
-
- org.apache.uima.internal.util.rb_trees.IntArrayRBTcommon
-
- org.apache.uima.internal.util.rb_trees.Int2IntRBT
-
public class Int2IntRBT extends IntArrayRBTcommon
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()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
Int2IntRBT.KeyIterator
private class
Int2IntRBT.KeyValueIterator
-
Field Summary
Fields Modifier and Type Field Description private int
lastNodeGotten
private int
prevValue
protected int[]
values
-
Fields inherited from class org.apache.uima.internal.util.rb_trees.IntArrayRBTcommon
black, color, debug, default_size, greatestNode, growth_factor, initialSize, klrp, klrp1, klrp2, klrp3, MAXklrp0, MAXklrpMask, multiplication_limit, next, NIL, red, root, size
-
-
Constructor Summary
Constructors Constructor Description Int2IntRBT()
Constructor for IntArrayRBT.Int2IntRBT(int initialSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Int2IntRBT
copy()
protected void
ensureCapacityKlrp(int requiredSize)
There are two strategies for storing data, controlled by useklrp.protected int
findKeyFast(int k)
Fast version of findKey Keeps the last node referenced *** NOT THREAD SAFE *** Tries to shorten the search path, conditionallyprivate int
findKeyFromLast(int k)
void
flush()
int
get(int k)
Get the value for a given keyint
getMostlyClose(int k)
private int
getValue(int node)
IntListIterator
keyIterator()
IntListIterator
keyIterator(int aKey)
IntKeyValueIterator
keyValueIterator()
IntKeyValueIterator
keyValueIterator(int aKey)
int
put(int k, int v)
adds a k, v pair.protected void
setupArrays()
private int
treeInsert(int k, int v)
-
Methods 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
-
-
-
-
Method Detail
-
getValue
private int getValue(int node)
-
setupArrays
protected void setupArrays()
- Overrides:
setupArrays
in classIntArrayRBTcommon
-
copy
public Int2IntRBT copy()
-
clear
public void clear()
-
flush
public void flush()
- Overrides:
flush
in classIntArrayRBTcommon
-
ensureCapacityKlrp
protected void ensureCapacityKlrp(int requiredSize)
Description copied from class:IntArrayRBTcommon
There 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:
ensureCapacityKlrp
in classIntArrayRBTcommon
- Parameters:
requiredSize
- -
-
treeInsert
private int treeInsert(int k, int v)
- Parameters:
k
- the key to insertv
- the value to insert (or replace, if key already present)- Returns:
- negative index if key is found
-
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:
- -
-
findKeyFromLast
private int findKeyFromLast(int k)
-
keyIterator
public IntListIterator keyIterator()
-
keyIterator
public IntListIterator keyIterator(int aKey)
-
keyValueIterator
public IntKeyValueIterator keyValueIterator()
-
keyValueIterator
public IntKeyValueIterator keyValueIterator(int aKey)
-
-