Class InvertedList

java.lang.Object
com.semedy.reasoner.edb.ramstore.InvertedList
All Implemented Interfaces:
Index, MainMemoryIndex

public class InvertedList extends Object implements MainMemoryIndex
  • Constructor Details

    • InvertedList

      public InvertedList(int indexedPosition, int arity, TupleStore tupleStore, boolean duplicates, ReasoningMonitor monitor)
  • Method Details

    • sizeInBytes

      public long sizeInBytes()
      Description copied from interface: Index
      Returns size in bytes used in main memory. Used for cache management
      Specified by:
      sizeInBytes in interface Index
      Returns:
    • clear

      public void clear()
    • size

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

      public boolean isEmpty()
    • addTuple

      public boolean addTuple(long term, int tuple) throws IOException
      add a tuple containing term
      Parameters:
      term -
      tuple -
      Returns:
      Throws:
      IOException
    • 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
    • removeTuple

      public boolean removeTuple(long term, int tuple)
      remove a tuple for term
      Parameters:
      term -
      tuple -
      Returns:
    • 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:
    • 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
    • containsTuple

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

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

      public boolean containsTuple(int values) throws IOException
      Description copied from interface: MainMemoryIndex
      contains method for main memory indices
      Specified by:
      containsTuple in interface MainMemoryIndex
      Returns:
      Throws:
      IOException
    • selectMatchingTuples

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

      public TupleEnumerator elements(long term, TupleEnumerator it)
    • elements

      public TupleEnumerator elements()
      Description copied from interface: MainMemoryIndex
      iterator for all elements
      Specified by:
      elements in interface MainMemoryIndex
      Returns:
    • 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
    • getTupleAddress

      public int getTupleAddress(int tuple)
      Description copied from interface: MainMemoryIndex
      get the address of a tuple
      Specified by:
      getTupleAddress in interface MainMemoryIndex
      Returns:
    • getTupleAddress

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