Package com.semedy.reasoner.edb.ramstore
Class HashIndex
java.lang.Object
com.semedy.reasoner.edb.ramstore.HashIndex
- All Implemented Interfaces:
Index,MainMemoryIndex
- Direct Known Subclasses:
PrimaryHashIndex,PrimaryIndex
Hashindex for tuples
- Author:
- angele
-
Constructor Summary
ConstructorsConstructorDescriptionHashIndex(int[] indexPositions, TupleStore tuplestore, int arity, int initialSize, ReasoningMonitor monitor) HashIndex(TupleStore tuplestore, int arity, int initialSize, ReasoningMonitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddTuple(int tuple) additional add method for main memory indicesbooleanaddTuple(TupleBuffer tuple) voidclear()booleancontainsTuple(int tuple) contains method for main memory indicesbooleancontainsTuple(long[] tuple) returns true if there exist matching valuesbooleancontainsTuple(TupleBuffer tuple) returns true if there exist matching valueselements()iterator for all elementsint[]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 tupleget the basic tuple storebooleanhasSelectMatchingTuples(TupleBuffer values) booleanremoveTuple(int tuple) additional remove method for main memory indicesselectMatchingTuples(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 tupleslongreturn number of bytes used in main memory.
-
Constructor Details
-
HashIndex
public HashIndex(int[] indexPositions, TupleStore tuplestore, int arity, int initialSize, ReasoningMonitor monitor) -
HashIndex
-
-
Method Details
-
sizeInBytes
public long sizeInBytes()return number of bytes used in main memory. Used for cache management- Specified by:
sizeInBytesin interfaceIndex- Returns:
-
getTupleStore
get the basic tuple store- Returns:
-
size
public long size()Description copied from interface:Indexreturns the number of indexed tuples -
clear
public void clear() -
removeTuple
public boolean removeTuple(int tuple) Description copied from interface:MainMemoryIndexadditional remove method for main memory indices- Specified by:
removeTuplein interfaceMainMemoryIndex- Returns:
-
addTuple
Description copied from interface:MainMemoryIndexadditional add method for main memory indices- Specified by:
addTuplein interfaceMainMemoryIndex- Returns:
- Throws:
IOException
-
addTuple
- Throws:
IOException
-
containsTuple
public boolean containsTuple(long[] tuple) Description copied from interface:Indexreturns true if there exist matching values- Specified by:
containsTuplein interfaceIndex- Parameters:
tuple- , values for indexed positions- Returns:
- boolean, true if there exist matching values
-
containsTuple
public boolean containsTuple(int tuple) Description copied from interface:MainMemoryIndexcontains method for main memory indices- Specified by:
containsTuplein interfaceMainMemoryIndex- Returns:
-
containsTuple
Description copied from interface:Indexreturns true if there exist matching values- Specified by:
containsTuplein interfaceIndex- Parameters:
tuple- , values for indexed positions- Returns:
- boolean, true if there exist matching values
-
elements
Description copied from interface:MainMemoryIndexiterator for all elements- Specified by:
elementsin interfaceMainMemoryIndex- Returns:
-
selectMatchingTuples
Description copied from interface:Indexreturns an enumerator for matching tuples reuse tuple enumerator- Specified by:
selectMatchingTuplesin interfaceIndex- Returns:
- 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
-
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
-
hasSelectMatchingTuples
- Throws:
IOExceptionEDBException
-
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
-
indexedValues
-
getTupleAddress
public int getTupleAddress(int tuple) get the address of a tuple- Specified by:
getTupleAddressin interfaceMainMemoryIndex- Parameters:
tuple-- Returns:
-
getTupleAddress
public int getTupleAddress(long[] tuple) get the address of a tuple- Specified by:
getTupleAddressin interfaceMainMemoryIndex- Parameters:
tuple-- Returns:
-