Documentation of 'org.hsqldb.lib.DoubleIntIndex' Java class
DoubleIntIndex
org.hsqldb.lib

Class DoubleIntIndex

  • All Implemented Interfaces:
    IntLookup, LongLookup


    public class DoubleIntIndex
    extends java.lang.Object
    implements IntLookup, LongLookup
    Maintains an ordered integer->integer lookup table, consisting of two columns, one for keys, the other for values. 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.

    findXXX() methods return the array index into the list pair containing a matching key or value, or 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)

    Since:
    1.8.0
    • Constructor Detail

      • DoubleIntIndex

        public DoubleIntIndex(int capacity,
                              boolean fixedSize)
    • Method Detail

      • getKey

        public int getKey(int i)
      • getValue

        public int getValue(int i)
      • setKey

        public void setKey(int i,
                           int key)
        Modifies an existing pair.
        Parameters:
        i - the index
        key - the key
      • setValue

        public void setValue(int i,
                             int value)
        Modifies an existing pair.
        Parameters:
        i - the index
        value - the value
      • size

        public int size()
      • capacity

        public int capacity()
      • getKeys

        public int[] getKeys()
      • getValues

        public int[] getValues()
      • getTotalValues

        public long getTotalValues()
      • setSize

        public void setSize(int newSize)
      • addUnsorted

        public boolean addUnsorted(long key,
                                   long value)
        Specified by:
        addUnsorted in interface LongLookup
      • addUnsorted

        public boolean addUnsorted(int key,
                                   int value)
        Adds a pair into the table.
        Specified by:
        addUnsorted in interface IntLookup
        Parameters:
        key - the key
        value - the value
        Returns:
        true or false depending on success
      • addSorted

        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()
        Parameters:
        key - the key
        value - the value
        Returns:
        true or false depending on success
      • addUnique

        public boolean addUnique(int key,
                                 int value)
        Adds a pair, ensuring no duplicate key xor value already exists in the current search target column.
        Parameters:
        key - the key
        value - the value
        Returns:
        true or false depending on success
      • add

        public int add(long key,
                       long value)
        Specified by:
        add in interface LongLookup
      • add

        public int add(int key,
                       int value)
        Adds a pair, maintaining sort order on current search target column.
        Specified by:
        add in interface IntLookup
        Parameters:
        key - the key
        value - the value
        Returns:
        index of added key or -1 if full
      • lookup

        public long lookup(long key)
                    throws java.util.NoSuchElementException
        Specified by:
        lookup in interface LongLookup
        Throws:
        java.util.NoSuchElementException
      • lookup

        public int lookup(int key)
                   throws java.util.NoSuchElementException
        Specified by:
        lookup in interface IntLookup
        Throws:
        java.util.NoSuchElementException
      • lookup

        public long lookup(long key,
                           long def)
        Specified by:
        lookup in interface LongLookup
      • lookup

        public int lookup(int key,
                          int def)
        Specified by:
        lookup in interface IntLookup
      • lookupFirstGreaterEqual

        public int lookupFirstGreaterEqual(int key)
                                    throws java.util.NoSuchElementException
        Throws:
        java.util.NoSuchElementException
      • setValuesSearchTarget

        public void setValuesSearchTarget()
      • setKeysSearchTarget

        public void setKeysSearchTarget()
      • 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
      • 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)

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.