| java.lang.Object org.hsqldb.store.HashIndex
HashIndex | class HashIndex (Code) | | 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.
author: fredt@users version: 1.7.2 since: 1.7.2 |
Constructor Summary | |
| HashIndex(int hashTableSize, int capacity, boolean fixedSize) |
Method Summary | |
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. |
elementCount | int elementCount(Code) | | |
fixedSize | boolean fixedSize(Code) | | |
hashTable | int[] hashTable(Code) | | |
linkTable | int[] linkTable(Code) | | |
newNodePointer | int newNodePointer(Code) | | |
reclaimedNodePointer | int reclaimedNodePointer(Code) | | |
HashIndex | HashIndex(int hashTableSize, int capacity, boolean fixedSize)(Code) | | |
clear | void clear()(Code) | | Reset the index as empty.
|
getHashIndex | int getHashIndex(int hash)(Code) | | Parameters: hash - |
getLookup | int getLookup(int hash)(Code) | | Return the array index for a hash.
Parameters: hash - the hash value used for indexing either -1 or the first node for this hash value |
getNextLookup | int getNextLookup(int lookup)(Code) | | This looks from a given node, so the parameter is always > -1.
Parameters: valid - lookup node to look from either -1 or the next node from this node |
linkNode | int linkNode(int index, int lastLookup)(Code) | | Link a new node to the end of the linked for a hash index.
Parameters: index - an index into hashTable Parameters: lastLookup - either -1 or the node to which the new node will be linked the new node |
removeEmptyNode | boolean removeEmptyNode(int lookup)(Code) | | 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 true if node found in unlinked state |
reset | void reset(int hashTableSize, int capacity)(Code) | | Reset the structure with a new size as empty.
Parameters: hashTableSize - Parameters: capacity - |
resetTables | void resetTables()(Code) | | |
unlinkNode | void unlinkNode(int index, int lastLookup, int lookup)(Code) | | Unlink a node from a linked list and link into the reclaimed list.
Parameters: index - an index into hashTable Parameters: lastLookup - either -1 or the node to which the target node is linked Parameters: lookup - the node to remove |
|
|