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
ConstructorDescriptionHashIndex
(int[] indexPositions, TupleStore tuplestore, int arity, int initialSize, ReasoningMonitor monitor) HashIndex
(TupleStore tuplestore, int arity, int initialSize, ReasoningMonitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addTuple
(int tuple) additional add method for main memory indicesboolean
addTuple
(TupleBuffer tuple) void
clear()
boolean
containsTuple
(int tuple) contains method for main memory indicesboolean
containsTuple
(long[] tuple) returns true if there exist matching valuesboolean
containsTuple
(TupleBuffer tuple) returns true if there exist matching valueselements()
iterator for all elementsint[]
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 tupleget the basic tuple storeboolean
hasSelectMatchingTuples
(TupleBuffer values) boolean
removeTuple
(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 tupleslong
size()
returns the number of indexed tupleslong
return 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:
sizeInBytes
in interfaceIndex
- Returns:
-
getTupleStore
get the basic tuple store- Returns:
-
size
public long size()Description copied from interface:Index
returns the number of indexed tuples -
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 interfaceMainMemoryIndex
- Returns:
-
addTuple
Description copied from interface:MainMemoryIndex
additional add method for main memory indices- Specified by:
addTuple
in interfaceMainMemoryIndex
- Returns:
- Throws:
IOException
-
addTuple
- Throws:
IOException
-
containsTuple
public boolean containsTuple(long[] tuple) Description copied from interface:Index
returns true if there exist matching values- Specified by:
containsTuple
in 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:MainMemoryIndex
contains method for main memory indices- Specified by:
containsTuple
in interfaceMainMemoryIndex
- Returns:
-
containsTuple
Description copied from interface:Index
returns true if there exist matching values- Specified by:
containsTuple
in interfaceIndex
- Parameters:
tuple
- , values for indexed positions- Returns:
- boolean, true if there exist matching values
-
elements
Description copied from interface:MainMemoryIndex
iterator for all elements- Specified by:
elements
in interfaceMainMemoryIndex
- Returns:
-
selectMatchingTuples
Description copied from interface:Index
returns an enumerator for matching tuples reuse tuple enumerator- Specified by:
selectMatchingTuples
in interfaceIndex
- Returns:
- 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
-
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
-
hasSelectMatchingTuples
- Throws:
IOException
EDBException
-
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
-
indexedValues
-
getTupleAddress
public int getTupleAddress(int tuple) get the address of a tuple- Specified by:
getTupleAddress
in interfaceMainMemoryIndex
- Parameters:
tuple
-- Returns:
-
getTupleAddress
public int getTupleAddress(long[] tuple) get the address of a tuple- Specified by:
getTupleAddress
in interfaceMainMemoryIndex
- Parameters:
tuple
-- Returns:
-