Module org.hsqldb
Package org.hsqldb.lib

## Class IntIndex

- java.lang.Object
- - org.hsqldb.lib.IntIndex

-     public class IntIndex
      extends java.lang.Object

  Maintains an ordered integer index. Equal keys are allowed. findXXX() methods return the array index into the list containing a matching key, or or -1 if not found.

  Since:
    2.3.3
  Author:
    Fred Toussi (fredt@users dot sourceforge.net)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `IntIndex​(int capacity, boolean fixedSize)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `add​(int key)` | Adds a key, maintaining sort order on current search target column.
    `boolean` | `addSorted​(int key)` | Adds a key into the table with the guarantee that the key is equal or larger than the largest existing key.
    `boolean` | `addUnique​(int key)` | Adds a key, ensuring no duplicate key already exists in the current search target column.
    `boolean` | `addUnsorted​(int key)` | Adds a key into the table.
    `int` | `capacity()` |
    `void` | `clear()` |
    `int` | `findFirstConsecutiveKeys​(int number)` |
    `int` | `findFirstEqualKeyIndex​(int value)` |
    `int` | `findFirstGreaterEqualKeyIndex​(int value)` |
    `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.
    `int` | `findFirstIndexUnsorted​(int value)` |
    `int` | `getKey​(int i)` |
    `int[]` | `getKeys()` |
    `long` | `getTotalValues()` |
    `void` | `remove​(int position)` |
    `void` | `removeAll()` |
    `int` | `removeFirstConsecutiveKeys​(int number, int def)` |
    `void` | `removeRange​(int start, int limit)` |
    `void` | `setKey​(int i, int key)` | Modifies an existing pair.
    `int` | `size()` |
    `void` | `sort()` |

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IntIndex

          public IntIndex​(int capacity,
                          boolean fixedSize)

  - ### Method Detail

    - #### getKey

          public int getKey​(int i)

    - #### setKey

          public void setKey​(int i,
                             int key)

      Modifies an existing pair.
      Parameters:
        `i` - the index
        `key` - the key

    - #### size

          public int size()

    - #### capacity

          public int capacity()

    - #### getKeys

          public int[] getKeys()

    - #### getTotalValues

          public long getTotalValues()

    - #### addUnsorted

          public boolean addUnsorted​(int key)

      Adds a key into the table.
      Parameters:
        `key` - the key
      Returns:
        true or false depending on success

    - #### addSorted

          public boolean addSorted​(int key)

      Adds a key 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()
      Parameters:
        `key` - the key
      Returns:
        true or false depending on success

    - #### addUnique

          public boolean addUnique​(int key)

      Adds a key, ensuring no duplicate key already exists in the current search target column.
      Parameters:
        `key` - the key
      Returns:
        true or false depending on success

    - #### add

          public int add​(int key)

      Adds a key, maintaining sort order on current search target column.
      Parameters:
        `key` - the key
      Returns:
        index of added key or -1 if full

    - #### clear

          public void clear()

    - #### findFirstIndexUnsorted

          public int findFirstIndexUnsorted​(int value)

    - #### findFirstGreaterEqualKeyIndex

          public int findFirstGreaterEqualKeyIndex​(int value)

      Parameters:
        `value` - the value
      Returns:
        the index

    - #### findFirstEqualKeyIndex

          public int findFirstEqualKeyIndex​(int value)

      Parameters:
        `value` - the value
      Returns:
        the index

    - #### findFirstConsecutiveKeys

          public int findFirstConsecutiveKeys​(int number)

      Parameters:
        `number` - the number of consecutive keys required
      Returns:
        the index or -1 if not found

    - #### removeFirstConsecutiveKeys

          public int removeFirstConsecutiveKeys​(int number,
                                                int def)

      Parameters:
        `number` - the number of consecutive keys required
        `def` - default value
      Returns:
        the first key in series or def if not found

    - #### findFirstGreaterEqualSlotIndex

          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.
      Parameters:
        `value` - the value
      Returns:
        the index

    - #### sort

          public void sort()

    - #### removeRange

          public void removeRange​(int start,
                                  int limit)

    - #### removeAll

          public void removeAll()

    - #### remove

          public final void remove​(int position)