Documentation of 'org.hsqldb.map.HashIndex' Java class
HashIndex
org.hsqldb.map

Class HashIndex



  • public class HashIndex
    extends java.lang.Object
    A chained bucket hash index implementation. hashTable and linkTable are arrays of signed integral types. This implementation uses int as the type but short or byte can be used for smaller index sizes (cardinality). hashTable[index] contains the pointer to the first node with (index == hash modulo hashTable.length) or -1 if there is no corresponding node. linkTable[{0,newNodePointer}] (the range between 0 and newNodePointer) contains either the pointer to the next node or -1 if there is no such node. reclaimedNodeIndex contains a pointer to an element of linkTable which is the first element in the list of reclaimed nodes (nodes no longer in index) or -1 if there is no such node. elemenet at and above linkTable[newNodePointer] have never been used as a node and their contents is not significant.
    Since:
    1.7.2
    • Constructor Summary

      Constructors 
      Constructor and Description
      HashIndex(int hashTableSize, int capacity, boolean fixedSize) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void clear()
      Reset the index as empty.
      int getHashIndex(int hash) 
      int getLookup(int hash)
      Return the array index for a hash.
      int getNextLookup(int lookup)
      This looks from a given node, so the parameter is always > -1.
      int linkNode(int index, int lastLookup)
      Link a new node to the end of the linked for a hash index.
      boolean removeEmptyNode(int lookup)
      Remove a node that has already been unlinked.
      void reset(int hashTableSize, int capacity)
      Reset the structure with a new size as empty.
      void resetTables() 
      void unlinkNode(int index, int lastLookup, int lookup)
      Unlink a node from a linked list and link into the reclaimed list.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HashIndex

        public HashIndex(int hashTableSize,
                         int capacity,
                         boolean fixedSize)
    • Method Detail

      • reset

        public void reset(int hashTableSize,
                          int capacity)
        Reset the structure with a new size as empty.
        Parameters:
        hashTableSize -
        capacity -
      • resetTables

        public void resetTables()
      • clear

        public void clear()
        Reset the index as empty.
      • getHashIndex

        public int getHashIndex(int hash)
        Parameters:
        hash -
      • getLookup

        public int getLookup(int hash)
        Return the array index for a hash.
        Parameters:
        hash - the hash value used for indexing
        Returns:
        either -1 or the first node for this hash value
      • getNextLookup

        public int getNextLookup(int lookup)
        This looks from a given node, so the parameter is always > -1.
        Parameters:
        lookup - A valid node to look from
        Returns:
        either -1 or the next node from this node
      • linkNode

        public int linkNode(int index,
                            int lastLookup)
        Link a new node to the end of the linked for a hash index.
        Parameters:
        index - an index into hashTable
        lastLookup - either -1 or the node to which the new node will be linked
        Returns:
        the new node
      • unlinkNode

        public void unlinkNode(int index,
                               int lastLookup,
                               int lookup)
        Unlink a node from a linked list and link into the reclaimed list.
        Parameters:
        index - an index into hashTable
        lastLookup - either -1 or the node to which the target node is linked
        lookup - the node to remove
      • removeEmptyNode

        public boolean removeEmptyNode(int lookup)
        Remove a node that has already been unlinked. This is not required for index operations. It is used only when the row needs to be removed from the data structures that store the actual indexed data and the nodes need to be contiguous.
        Parameters:
        lookup - the node to remove
        Returns:
        true if node found in unlinked state

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.