Package com.semedy.reasoner.edb.ramstore
Class InvertedList
java.lang.Object
com.semedy.reasoner.edb.ramstore.InvertedList
- All Implemented Interfaces:
Index
,MainMemoryIndex
-
Constructor Summary
ConstructorDescriptionInvertedList
(int indexedPosition, int arity, TupleStore tupleStore, boolean duplicates, ReasoningMonitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addTuple
(int tuple) additional add method for main memory indicesboolean
addTuple
(long term, int tuple) add a tuple containing termvoid
clear()
boolean
containsTuple
(int values) contains method for main memory indicesboolean
containsTuple
(long[] values) returns true if there exist matching valuesboolean
containsTuple
(TupleBuffer values) returns true if there exist matching valueselements()
iterator for all elementselements
(long term, TupleEnumerator it) int[]
Returns the indexed positionslong
getNumberOfMatchingTuples
(long[] values) returns the number of matching tuplesint
getTupleAddress
(int tuple) get the address of a tupleint
getTupleAddress
(long[] tuple) get the address of a tupleboolean
isEmpty()
boolean
removeTuple
(int tuple) additional remove method for main memory indicesboolean
removeTuple
(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 tupleslong
size()
returns the number of indexed tupleslong
Returns 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:Index
Returns size in bytes used in main memory. Used for cache management- Specified by:
sizeInBytes
in interfaceIndex
- Returns:
-
clear
public void clear() -
size
public long size()Description copied from interface:Index
returns 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:MainMemoryIndex
additional add method for main memory indices- Specified by:
addTuple
in 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:MainMemoryIndex
additional remove method for main memory indices- Specified by:
removeTuple
in interfaceMainMemoryIndex
- Returns:
-
selectMatchingTuples
Description copied from interface:Index
returns an enumerator for matching tuples- Specified by:
selectMatchingTuples
in interfaceIndex
- Parameters:
values
- , values for indexed positions- Returns:
- enumerator for matching tuples
- Throws:
IOException
-
selectMatchingTuples
Description copied from interface:Index
returns an enumerator for matching tuples- Specified by:
selectMatchingTuples
in interfaceIndex
- Parameters:
values
- , values for indexed positions- Returns:
- enumerator for matching tuples
- Throws:
IOException
-
containsTuple
Description copied from interface:Index
returns true if there exist matching values- Specified by:
containsTuple
in interfaceIndex
- Parameters:
values
- , values for indexed positions- Returns:
- boolean, true if there exist matching values
- Throws:
IOException
-
containsTuple
Description copied from interface:Index
returns true if there exist matching values- Specified by:
containsTuple
in interfaceIndex
- Parameters:
values
- , values for indexed positions- Returns:
- boolean, true if there exist matching values
- Throws:
IOException
-
containsTuple
Description copied from interface:MainMemoryIndex
contains method for main memory indices- Specified by:
containsTuple
in interfaceMainMemoryIndex
- Returns:
- Throws:
IOException
-
selectMatchingTuples
Description copied from interface:Index
returns an enumerator for matching tuples reuse tuple enumerator- Specified by:
selectMatchingTuples
in interfaceIndex
- Returns:
-
elements
-
elements
Description copied from interface:MainMemoryIndex
iterator for all elements- Specified by:
elements
in interfaceMainMemoryIndex
- Returns:
-
getNumberOfMatchingTuples
Description copied from interface:Index
returns the number of matching tuples- Specified by:
getNumberOfMatchingTuples
in interfaceIndex
- 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 interfaceIndex
- 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 interfaceMainMemoryIndex
- Returns:
-
getTupleAddress
public int getTupleAddress(long[] tuple) Description copied from interface:MainMemoryIndex
get the address of a tuple- Specified by:
getTupleAddress
in interfaceMainMemoryIndex
- Returns:
-