Class HashIndex

java.lang.Object
com.semedy.reasoner.edb.ramstore.HashIndex
All Implemented Interfaces:
Index, MainMemoryIndex
Direct Known Subclasses:
PrimaryHashIndex, PrimaryIndex

public class HashIndex extends Object implements MainMemoryIndex
Hashindex for tuples
Author:
angele
  • Constructor Details

  • Method Details

    • sizeInBytes

      public long sizeInBytes()
      return number of bytes used in main memory. Used for cache management
      Specified by:
      sizeInBytes in interface Index
      Returns:
    • getTupleStore

      public TupleStore getTupleStore()
      get the basic tuple store
      Returns:
    • size

      public long size()
      Description copied from interface: Index
      returns the number of indexed tuples
      Specified by:
      size in interface Index
      Returns:
    • clear

      public void clear()
    • removeTuple

      public boolean removeTuple(int tuple)
      Description copied from interface: MainMemoryIndex
      additional remove method for main memory indices
      Specified by:
      removeTuple in interface MainMemoryIndex
      Returns:
    • addTuple

      public boolean addTuple(int tuple) throws IOException
      Description copied from interface: MainMemoryIndex
      additional add method for main memory indices
      Specified by:
      addTuple in interface MainMemoryIndex
      Returns:
      Throws:
      IOException
    • addTuple

      public boolean addTuple(TupleBuffer tuple) throws IOException
      Throws:
      IOException
    • containsTuple

      public boolean containsTuple(long[] tuple)
      Description copied from interface: Index
      returns true if there exist matching values
      Specified by:
      containsTuple in interface Index
      Parameters:
      tuple - , values for indexed positions
      Returns:
      boolean, true if there exist matching values
    • containsTuple

      public boolean containsTuple(int tuple)
      Description copied from interface: MainMemoryIndex
      contains method for main memory indices
      Specified by:
      containsTuple in interface MainMemoryIndex
      Returns:
    • containsTuple

      public boolean containsTuple(TupleBuffer tuple)
      Description copied from interface: Index
      returns true if there exist matching values
      Specified by:
      containsTuple in interface Index
      Parameters:
      tuple - , values for indexed positions
      Returns:
      boolean, true if there exist matching values
    • elements

      public TupleEnumerator elements()
      Description copied from interface: MainMemoryIndex
      iterator for all elements
      Specified by:
      elements in interface MainMemoryIndex
      Returns:
    • selectMatchingTuples

      public TupleEnumerator selectMatchingTuples(long[] values, TupleEnumerator it) throws IOException
      Description copied from interface: Index
      returns an enumerator for matching tuples reuse tuple enumerator
      Specified by:
      selectMatchingTuples in interface Index
      Returns:
      Throws:
      IOException
    • selectMatchingTuples

      public TupleEnumerator selectMatchingTuples(long[] values) throws IOException
      Description copied from interface: Index
      returns an enumerator for matching tuples
      Specified by:
      selectMatchingTuples in interface Index
      Parameters:
      values - , values for indexed positions
      Returns:
      enumerator for matching tuples
      Throws:
      IOException
    • selectMatchingTuples

      public TupleEnumerator selectMatchingTuples(TupleBuffer values) throws IOException
      Description copied from interface: Index
      returns an enumerator for matching tuples
      Specified by:
      selectMatchingTuples in interface Index
      Parameters:
      values - , values for indexed positions
      Returns:
      enumerator for matching tuples
      Throws:
      IOException
    • hasSelectMatchingTuples

      public boolean hasSelectMatchingTuples(TupleBuffer values) throws IOException, EDBException
      Throws:
      IOException
      EDBException
    • getNumberOfMatchingTuples

      public long getNumberOfMatchingTuples(long[] values) throws IOException, EDBException
      Description copied from interface: Index
      returns the number of matching tuples
      Specified by:
      getNumberOfMatchingTuples in interface Index
      Parameters:
      values - , values for indexed positions
      Returns:
      number of matching tuples
      Throws:
      EDBException
      IOException
    • getIndexedPositions

      public int[] getIndexedPositions()
      Description copied from interface: Index
      Returns the indexed positions
      Specified by:
      getIndexedPositions in interface Index
      Returns:
      the indexed positions
    • indexedValues

      public SelectableIndexEnumerator indexedValues()
    • getTupleAddress

      public int getTupleAddress(int tuple)
      get the address of a tuple
      Specified by:
      getTupleAddress in interface MainMemoryIndex
      Parameters:
      tuple -
      Returns:
    • getTupleAddress

      public int getTupleAddress(long[] tuple)
      get the address of a tuple
      Specified by:
      getTupleAddress in interface MainMemoryIndex
      Parameters:
      tuple -
      Returns: