Module org.hsqldb
Package org.hsqldb.lib

## Class DoubleLongIndex

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

- All Implemented Interfaces:
    `LongLookup`

      public final class DoubleLongIndex
      extends java.lang.Object
      implements LongLookup

  Maintains an ordered `long->long` lookup table, consisting of two columns, one for keys, the other for values. Equal keys are allowed.

  The table is sorted on key column.

  findXXX() methods return the array index into the list pair containing a matching key or value, or or -1 if not found.

  Based on org.hsqldb.lib.DoubleIntIndex

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

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DoubleLongIndex​(int capacity)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `add​(long key, long value)` |
    `boolean` | `addUnsorted​(long key, long value)` |
    `boolean` | `addUnsorted​(LongLookup other)` |
    `void` | `clear()` |
    `boolean` | `compactLookupAsIntervals()` |
    `void` | `copyTo​(DoubleLongIndex other)` |
    `LongLookup` | `duplicate()` |
    `int` | `findFirstEqualKeyIndex​(long value)` |
    `int` | `findFirstGreaterEqualKeyIndex​(long value)` |
    `int` | `findFirstGreaterEqualSlotIndex​(long 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.
    `long` | `getLongKey​(int i)` |
    `long` | `getLongValue​(int i)` |
    `long` | `getTotalValues()` |
    `long` | `lookup​(long key)` |
    `long` | `lookup​(long key, long def)` |
    `void` | `setLongValue​(int i, long value)` | Modifies an existing pair.
    `void` | `setSize​(int newSize)` |
    `int` | `size()` |
    `void` | `sort()` |

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

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

- - ### Constructor Detail

    - #### DoubleLongIndex

          public DoubleLongIndex​(int capacity)

  - ### Method Detail

    - #### getLongKey

          public long getLongKey​(int i)

      Specified by:
        `getLongKey` in interface `LongLookup`

    - #### getLongValue

          public long getLongValue​(int i)

      Specified by:
        `getLongValue` in interface `LongLookup`

    - #### setLongValue

          public void setLongValue​(int i,
                                   long value)

      Modifies an existing pair.
      Specified by:
        `setLongValue` in interface `LongLookup`
      Parameters:
        `i` - the index
        `value` - the value

    - #### size

          public int size()

      Specified by:
        `size` in interface `LongLookup`

    - #### getTotalValues

          public long getTotalValues()

      Specified by:
        `getTotalValues` in interface `LongLookup`

    - #### setSize

          public void setSize​(int newSize)

    - #### addUnsorted

          public boolean addUnsorted​(long key,
                                     long value)

      Specified by:
        `addUnsorted` in interface `LongLookup`

    - #### add

          public int add​(long key,
                         long value)

      Specified by:
        `add` in interface `LongLookup`

    - #### lookup

          public long lookup​(long key)
                      throws java.util.NoSuchElementException

      Specified by:
        `lookup` in interface `LongLookup`
      Throws:
        `java.util.NoSuchElementException`

    - #### lookup

          public long lookup​(long key,
                             long def)

      Specified by:
        `lookup` in interface `LongLookup`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `LongLookup`

    - #### duplicate

          public LongLookup duplicate()

      Specified by:
        `duplicate` in interface `LongLookup`

    - #### findFirstGreaterEqualKeyIndex

          public int findFirstGreaterEqualKeyIndex​(long value)

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

    - #### findFirstEqualKeyIndex

          public int findFirstEqualKeyIndex​(long value)

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

    - #### findFirstGreaterEqualSlotIndex

          public int findFirstGreaterEqualSlotIndex​(long 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

    - #### compactLookupAsIntervals

          public boolean compactLookupAsIntervals()

      Specified by:
        `compactLookupAsIntervals` in interface `LongLookup`

    - #### sort

          public void sort()

      Specified by:
        `sort` in interface `LongLookup`

    - #### copyTo

          public void copyTo​(DoubleLongIndex other)

    - #### addUnsorted

          public boolean addUnsorted​(LongLookup other)

      Specified by:
        `addUnsorted` in interface `LongLookup`