Package com.semedy.reasoner.edb.ramstore
Class InvertedList
java.lang.Object
com.semedy.reasoner.edb.ramstore.InvertedList
- All Implemented Interfaces:
Index,MainMemoryIndex
-
Constructor Summary
ConstructorsConstructorDescriptionInvertedList(int indexedPosition, int arity, TupleStore tupleStore, boolean duplicates, ReasoningMonitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddTuple(int tuple) additional add method for main memory indicesbooleanaddTuple(long term, int tuple) add a tuple containing termvoidclear()booleancontainsTuple(int values) contains method for main memory indicesbooleancontainsTuple(long[] values) returns true if there exist matching valuesbooleancontainsTuple(TupleBuffer values) returns true if there exist matching valueselements()iterator for all elementselements(long term, TupleEnumerator it) int[]Returns the indexed positionslonggetNumberOfMatchingTuples(long[] values) returns the number of matching tuplesintgetTupleAddress(int tuple) get the address of a tupleintgetTupleAddress(long[] tuple) get the address of a tuplebooleanisEmpty()booleanremoveTuple(int tuple) additional remove method for main memory indicesbooleanremoveTuple(long term, int tuple) remove a tuple for termselectMatchingTuples(long[] values) returns an enumerator for matching tuplesselectMatchingTuples(long[] values, TupleEnumerator it) returns an enumerator for matching tuples reuse tuple enumeratorselectMatchingTuples(TupleBuffer values) returns an enumerator for matching tupleslongsize()returns the number of indexed tupleslongReturns size in bytes used in main memory.
-
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:IndexReturns size in bytes used in main memory. Used for cache management- Specified by:
sizeInBytesin interfaceIndex- Returns:
-
clear
public void clear() -
size
public long size()Description copied from interface:Indexreturns the number of indexed tuples -
isEmpty
public boolean isEmpty() -
addTuple
add a tuple containing term- Parameters:
term-tuple-- Returns:
- Throws:
IOException
-
addTuple
Description copied from interface:MainMemoryIndexadditional add method for main memory indices- Specified by:
addTuplein interfaceMainMemoryIndex- 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:MainMemoryIndexadditional remove method for main memory indices- Specified by:
removeTuplein interfaceMainMemoryIndex- Returns:
-
selectMatchingTuples
Description copied from interface:Indexreturns an enumerator for matching tuples- Specified by:
selectMatchingTuplesin interfaceIndex- Parameters:
values- , values for indexed positions- Returns:
- enumerator for matching tuples
- Throws:
IOException
-
selectMatchingTuples
Description copied from interface:Indexreturns an enumerator for matching tuples- Specified by:
selectMatchingTuplesin interfaceIndex- Parameters:
values- , values for indexed positions- Returns:
- enumerator for matching tuples
- Throws:
IOException
-
containsTuple
Description copied from interface:Indexreturns true if there exist matching values- Specified by:
containsTuplein interfaceIndex- Parameters:
values- , values for indexed positions- Returns:
- boolean, true if there exist matching values
- Throws:
IOException
-
containsTuple
Description copied from interface:Indexreturns true if there exist matching values- Specified by:
containsTuplein interfaceIndex- Parameters:
values- , values for indexed positions- Returns:
- boolean, true if there exist matching values
- Throws:
IOException
-
containsTuple
Description copied from interface:MainMemoryIndexcontains method for main memory indices- Specified by:
containsTuplein interfaceMainMemoryIndex- Returns:
- Throws:
IOException
-
selectMatchingTuples
Description copied from interface:Indexreturns an enumerator for matching tuples reuse tuple enumerator- Specified by:
selectMatchingTuplesin interfaceIndex- Returns:
-
elements
-
elements
Description copied from interface:MainMemoryIndexiterator for all elements- Specified by:
elementsin interfaceMainMemoryIndex- Returns:
-
getNumberOfMatchingTuples
Description copied from interface:Indexreturns the number of matching tuples- Specified by:
getNumberOfMatchingTuplesin interfaceIndex- Parameters:
values- , values for indexed positions- Returns:
- number of matching tuples
- Throws:
EDBExceptionIOException
-
getIndexedPositions
public int[] getIndexedPositions()Description copied from interface:IndexReturns the indexed positions- Specified by:
getIndexedPositionsin interfaceIndex- Returns:
- the indexed positions
-
getTupleAddress
public int getTupleAddress(int tuple) Description copied from interface:MainMemoryIndexget the address of a tuple- Specified by:
getTupleAddressin interfaceMainMemoryIndex- Returns:
-
getTupleAddress
public int getTupleAddress(long[] tuple) Description copied from interface:MainMemoryIndexget the address of a tuple- Specified by:
getTupleAddressin interfaceMainMemoryIndex- Returns:
-