integer->integer lookup table, consisting of two
columns, one for keys, the other for values. Equal keys are allowed.
The table is sorted on either the key or value column, depending on the calls to
setKeysSearchTarget() or setValuesSearchTarget(). By default, the table is
sorted on values. Equal values are sorted by key.findXXX() methods return the array index into the list pair containing a matching key or value, or -1 if not found.
Sorting methods originally contributed by Tony Lai (tony_lai@users dot sourceforge.net). Non-recursive implementation of fast quicksort added by Sergio Bossa (sbtourist@users dot sourceforge.net)
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private int | |
| private final boolean | |
| private int[] | |
| private boolean | |
| private boolean | |
| private int | |
| private int[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public int | Returns: index of added key or -1 if fullthe key key, int the value value)Adds a pair, maintaining sort order on current search target column. |
| public int | Returns: the new count for the keythe key to update or add key, int the count to add value)Used for values as counters. |
| public int | |
| public boolean | Returns: true or false depending on successthe key to add or find key, int the value to add or update value)Updates the value if key is present, or adds the key/value paire. |
| public boolean | Returns: true or false depending on successthe key key, int the value value)Adds a key, value pair into the table with the guarantee that the key is equal or larger than the largest existing key. |
| public boolean | Returns: true or false depending on successthe key key, int the value value)Adds a pair, ensuring no duplicate key xor value already exists in the current search target column. |
| public boolean | |
| public boolean | Returns: true or false depending on successthe key key, int the value value)Adds a pair into the table. |
| public boolean | |
| private int | Returns: the indexReturns the index of the lowest element |
| private int | Returns: index or -1 if not foundReturns the index of the lowest element == the given search target, or -1 |
| private int | Returns: the index or count.ignored fullCompare)Returns the index of the lowest element |
| public int | |
| public void | |
| public boolean | |
| protected int | Returns: -1, 0 or +1the index i)Check if targeted column value in the row indexed i is less than the search target object. |
| public void | |
| protected void | |
| public LongLookup | |
| private boolean | |
| private void | |
| private void | |
| public int | |
| public int | |
| public int | Returns: the indexthe value value)This method is similar to findFirstGreaterEqualKeyIndex(int) but returns the index of the empty row past the end of the array if the search value is larger than all the values / keys in the searched column. |
| public int | |
| public int[] | |
| public long | |
| public long | |
| public long | |
| public int | |
| public int[] | |
| private void | |
| protected boolean | Returns: true or falsethe first index i, int the second index j)Check if row indexed i is less than row indexed j |
| public long | |
| public int | |
| public long | |
| public int | |
| public int | |
| protected void | |
| protected void | |
| private int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv boolean | |
| private void | |
| public final void | |
| public void | |
| public boolean | Returns: true or false depending on successthe key to remove key)Removes the (unique) key and its value. |
| public void | |
| public void | |
| public void | |
| public void | setLongValue(int
the index i, long the new value value)Implements org. Modifies an existing pair at the given index. |
| public void | |
| public void | |
| public void | |
| public int | |
| public void | |
| public void | |
| public void | |
| protected void |
| capacity | back to summary |
|---|---|
| private int capacity | |
| count | back to summary |
|---|---|
| private int count | |
| fixedSize | back to summary |
|---|---|
| private final boolean fixedSize | |
| keys | back to summary |
|---|---|
| private int[] keys | |
| sorted | back to summary |
|---|---|
| private boolean sorted | |
| sortOnValues | back to summary |
|---|---|
| private boolean sortOnValues | |
| targetSearchValue | back to summary |
|---|---|
| private int targetSearchValue | |
| values | back to summary |
|---|---|
| private int[] values | |
| DoubleIntIndex | back to summary |
|---|---|
| public DoubleIntIndex(int capacity) | |
| DoubleIntIndex | back to summary |
|---|---|
| public DoubleIntIndex(int capacity, boolean fixedSize) | |
| add | back to summary |
|---|---|
| public int add(long key, long value) Implements org. | |
| add | back to summary |
|---|---|
| public int add(int key, int value) Adds a pair, maintaining sort order on current search target column.
| |
| addCount | back to summary |
|---|---|
| public int addCount(int key, int value) Used for values as counters. Adds the value to the existing value for the key. Or adds the key - value pair.
| |
| addCount | back to summary |
|---|---|
| public int addCount(int key) | |
| addOrReplaceUnique | back to summary |
|---|---|
| public boolean addOrReplaceUnique(int key, int value) Updates the value if key is present, or adds the key/value paire. Must be sorted on key.
| |
| addSorted | back to summary |
|---|---|
| public boolean addSorted(int key, int value) Adds a key, value pair into the table with the guarantee that the key is equal or larger than the largest existing key. This prevents a sort from taking place on next call to find()
| |
| addUnique | back to summary |
|---|---|
| public boolean addUnique(int key, int value) Adds a pair, ensuring no duplicate key xor value already exists in the current search target column.
| |
| addUnsorted | back to summary |
|---|---|
| public boolean addUnsorted(long key, long value) Implements org. | |
| addUnsorted | back to summary |
|---|---|
| public boolean addUnsorted(int key, int value) Adds a pair into the table.
| |
| addUnsorted | back to summary |
|---|---|
| public boolean addUnsorted(LongLookup other) Implements org. | |
| binaryEmptySlotSearch | back to summary |
|---|---|
| private int binaryEmptySlotSearch() Returns the index of the lowest element
| |
| binaryFirstSearch | back to summary |
|---|---|
| private int binaryFirstSearch() Returns the index of the lowest element == the given search target, or -1
| |
| binarySlotSearch | back to summary |
|---|---|
| private int binarySlotSearch(boolean fullCompare) Returns the index of the lowest element
| |
| capacity | back to summary |
|---|---|
| public int capacity() | |
| clear | back to summary |
|---|---|
| public void clear() Implements org. | |
| compactLookupAsIntervals | back to summary |
|---|---|
| public boolean compactLookupAsIntervals() Implements org. | |
| compare | back to summary |
|---|---|
| protected int compare(int i) Check if targeted column value in the row indexed i is less than the search target object.
| |
| copyTo | back to summary |
|---|---|
| public void copyTo(DoubleIntIndex other) | |
| doubleCapacity | back to summary |
|---|---|
| protected void doubleCapacity() | |
| duplicate | back to summary |
|---|---|
| public LongLookup duplicate() Implements org. | |
| ensureCapacityToAdd | back to summary |
|---|---|
| private boolean ensureCapacityToAdd(int extra) | |
| fastQuickSort | back to summary |
|---|---|
| private void fastQuickSort() fast quicksort using a stack on the heap to reduce stack use | |
| fastQuickSortRecursive | back to summary |
|---|---|
| private void fastQuickSortRecursive() fast quicksort with recursive quicksort implementation | |
| findFirstEqualKeyIndex | back to summary |
|---|---|
public int findFirstEqualKeyIndex(int value)
| |
| findFirstGreaterEqualKeyIndex | back to summary |
|---|---|
public int findFirstGreaterEqualKeyIndex(int value)
| |
| findFirstGreaterEqualSlotIndex | back to summary |
|---|---|
| public int findFirstGreaterEqualSlotIndex(int value) This method is similar to findFirstGreaterEqualKeyIndex(int) but returns the index of the empty row past the end of the array if the search value is larger than all the values / keys in the searched column.
| |
| getKey | back to summary |
|---|---|
| public int getKey(int i) | |
| getKeys | back to summary |
|---|---|
| public int[] getKeys() | |
| getLongKey | back to summary |
|---|---|
| public long getLongKey(int i) Implements org. | |
| getLongValue | back to summary |
|---|---|
| public long getLongValue(int i) Implements org. | |
| getTotalValues | back to summary |
|---|---|
| public long getTotalValues() Implements org. | |
| getValue | back to summary |
|---|---|
| public int getValue(int i) | |
| getValues | back to summary |
|---|---|
| public int[] getValues() | |
| insertionSort | back to summary |
|---|---|
| private void insertionSort(int lo0, int hi0) | |
| lessThan | back to summary |
|---|---|
| protected boolean lessThan(int i, int j) Check if row indexed i is less than row indexed j
| |
| lookup | back to summary |
|---|---|
| public long lookup(long key) throws NoSuchElementException Implements org. | |
| lookup | back to summary |
|---|---|
| public int lookup(int key) throws NoSuchElementException | |
| lookup | back to summary |
|---|---|
| public long lookup(long key, long def) Implements org. | |
| lookup | back to summary |
|---|---|
| public int lookup(int key, int def) | |
| lookupFirstGreaterEqual | back to summary |
|---|---|
| public int lookupFirstGreaterEqual(int key) throws NoSuchElementException | |
| moveAndInsertRow | back to summary |
|---|---|
| protected void moveAndInsertRow(int i, int j) | |
| moveRows | back to summary |
|---|---|
| protected void moveRows(int fromIndex, int toIndex, int rows) | |
| partition | back to summary |
|---|---|
| private int partition(int start, int end) | |
| peekKey | back to summary |
|---|---|
| pack-priv int peekKey() peek the key at top of stack. Uses the data structure as a stack.
| |
| peekValue | back to summary |
|---|---|
| pack-priv int peekValue() peek the value at top of stack
| |
| pop | back to summary |
|---|---|
| pack-priv boolean pop() pop the pair at top of stack
| |
| push | back to summary |
|---|---|
| pack-priv boolean push(int key, int value) push key - value pair
| |
| quickSort | back to summary |
|---|---|
| private void quickSort(int l, int r) | |
| remove | back to summary |
|---|---|
| public final void remove(int position) | |
| removeAll | back to summary |
|---|---|
| public void removeAll() | |
| removeKey | back to summary |
|---|---|
| public boolean removeKey(int key) Removes the (unique) key and its value. Must be sorted on key.
| |
| removeRange | back to summary |
|---|---|
| public void removeRange(int start, int limit) | |
| setKey | back to summary |
|---|---|
| public void setKey(int i, int key) Modifies an existing pair at the given index.
| |
| setKeysSearchTarget | back to summary |
|---|---|
| public void setKeysSearchTarget() | |
| setLongValue | back to summary |
|---|---|
| public void setLongValue(int i, long value) Implements org. Modifies an existing pair at the given index.
| |
| setSize | back to summary |
|---|---|
| public void setSize(int newSize) | |
| setValue | back to summary |
|---|---|
| public void setValue(int i, int value) Modifies an existing pair at the given index.
| |
| setValuesSearchTarget | back to summary |
|---|---|
| public void setValuesSearchTarget() | |
| size | back to summary |
|---|---|
| public int size() Implements org. | |
| sort | back to summary |
|---|---|
| public void sort() Implements org. | |
| sortOnKeys | back to summary |
|---|---|
| public void sortOnKeys() | |
| sortOnValues | back to summary |
|---|---|
| public void sortOnValues() | |
| swap | back to summary |
|---|---|
| protected void swap(int i1, int i2) | |