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 sequenceintnumber of tuples -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()clear the tuple storeclone()clone a tuple store with the whole contentintdecrementNGetReferenceCount(int t) decrement and get reference count for tuple tintgetArity()get the aritylong[]return the dataintgetReferenceCount(int t) returns a reference counter for tuple tvoidincReferenceCount(int t) increment reference count for tuple tintnewTuple()create a new tuple of length arity and return the addressintnewTuple(long[] buf) create a new tuple and copy buf into that tuple and return the addressintnewTuple(TupleBuffer buf) create a new tuple and copy buf into that tuple and return the addressvoidremoveTuple(int address) remove a tuple at address and with a certain lengthvoidsetReferenceCount(int t, int count) set the reference count for tuple tintsize()return the number of tuplesintnumber 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
-