Package com.semedy.reasoner.edb.ramstore
Class TupleStore
java.lang.Object
com.semedy.reasoner.edb.ramstore.TupleStore
- Direct Known Subclasses:
TupleStoreWithReferenceCounters
-
Field Summary
FieldsModifier and TypeFieldDescriptionlong[]
the memory piece where all tuples are residing in a sequenceint
number of tuples -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
clear the tuple storeclone()
clone a tuple store with the whole contentint
decrementNGetReferenceCount
(int t) decrement and get reference count for tuple tint
getArity()
get the aritylong[]
return the dataint
getReferenceCount
(int t) returns a reference counter for tuple tvoid
incReferenceCount
(int t) increment reference count for tuple tint
newTuple()
create a new tuple of length arity and return the addressint
newTuple
(long[] buf) create a new tuple and copy buf into that tuple and return the addressint
newTuple
(TupleBuffer buf) create a new tuple and copy buf into that tuple and return the addressvoid
removeTuple
(int address) remove a tuple at address and with a certain lengthvoid
setReferenceCount
(int t, int count) set the reference count for tuple tint
size()
return the number of tuplesint
number of bytes used in main memory.
-
Field Details
-
_elementData
public long[] _elementDatathe memory piece where all tuples are residing in a sequence -
_elements
public int _elementsnumber of tuples
-
-
Constructor Details
-
TupleStore
-
TupleStore
public TupleStore(int arity)
-
-
Method Details
-
getArity
public int getArity()get the arity- Returns:
-
sizeInBytes
public int sizeInBytes()number of bytes used in main memory. Used for cache management- Returns:
-
newTuple
create a new tuple of length arity and return the address- Returns:
- Throws:
IOException
-
getElementData
public long[] getElementData()return the data- Returns:
-
newTuple
create a new tuple and copy buf into that tuple and return the address- Parameters:
buf
-- Returns:
- Throws:
IOException
-
newTuple
create a new tuple and copy buf into that tuple and return the address- Parameters:
buf
-- Returns:
- Throws:
IOException
-
removeTuple
public void removeTuple(int address) remove a tuple at address and with a certain length- Parameters:
address
-
-
size
public int size()return the number of tuples- Returns:
-
clear
public void clear()clear the tuple store -
getReferenceCount
public int getReferenceCount(int t) returns a reference counter for tuple t- Parameters:
t
- , tuple address- Returns:
-
setReferenceCount
public void setReferenceCount(int t, int count) set the reference count for tuple t- Parameters:
t
- , tuplecount
- , reference count
-
incReferenceCount
public void incReferenceCount(int t) increment reference count for tuple t- Parameters:
t
- , tuple
-
decrementNGetReferenceCount
public int decrementNGetReferenceCount(int t) decrement and get reference count for tuple t- Parameters:
t
- , tuple- Returns:
-
clone
clone a tuple store with the whole content
-