public abstract class AbstractTupleSet extends java.lang.Object implements ITupleSet
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractTupleSet.LTEntry |
Modifier and Type | Field and Description |
---|---|
protected java.util.List<AbstractTupleSet.LTEntry> |
tAdded |
protected boolean |
transaction |
protected java.util.List<AbstractTupleSet.LTEntry> |
tRemoved |
protected DoubleKeyMVMap<java.lang.String,java.lang.String,LogicTuple> |
tuples |
Constructor and Description |
---|
AbstractTupleSet() |
Modifier and Type | Method and Description |
---|---|
void |
add(LogicTuple t)
Add a logic tuple to tuple set.
|
void |
beginTransaction()
Begins a transaction section
Every operation on multiset can be undone
|
void |
empty()
Removes all element from Tuple Set.
|
void |
endTransaction(boolean commit)
Ends a transaction section specifying if operations must be committed or
undone
|
java.util.Iterator<LogicTuple> |
getIterator() |
LogicTuple |
getMatchingTuple(LogicTuple templ) |
protected abstract java.lang.String |
getTupleKey1(LogicTuple t) |
protected abstract java.lang.String |
getTupleKey2(LogicTuple t) |
boolean |
isEmpty()
Returns
true if the tuple set contains no elements. |
boolean |
operationsPending()
Tells whether there are changes in the tuple multi-set during a
transaction
|
LogicTuple |
readMatchingTuple(LogicTuple templ) |
void |
remove(LogicTuple t)
Remove a logic tuple from tuple set.
|
int |
size()
Returns the number of elements in this tuple set.
|
LogicTuple[] |
toArray() |
java.lang.String |
toString()
Provides a representation of the tuple multi-set in the form of a String
containing a prolog theory.
|
protected java.util.List<AbstractTupleSet.LTEntry> tAdded
protected boolean transaction
protected java.util.List<AbstractTupleSet.LTEntry> tRemoved
protected DoubleKeyMVMap<java.lang.String,java.lang.String,LogicTuple> tuples
public void add(LogicTuple t)
ITupleSet
public void beginTransaction()
ITupleSet
beginTransaction
in interface ITupleSet
public void empty()
ITupleSet
public void endTransaction(boolean commit)
ITupleSet
endTransaction
in interface ITupleSet
commit
- if true
the operations are committed, else they are
undone and the multiset is rolled back to the state before the
beginTransaction
invocationpublic java.util.Iterator<LogicTuple> getIterator()
getIterator
in interface ITupleSet
public LogicTuple getMatchingTuple(LogicTuple templ)
getMatchingTuple
in interface ITupleSet
templ
- the tuple template to use for unificationpublic boolean isEmpty()
ITupleSet
true
if the tuple set contains no elements.public boolean operationsPending()
ITupleSet
operationsPending
in interface ITupleSet
public LogicTuple readMatchingTuple(LogicTuple templ)
readMatchingTuple
in interface ITupleSet
templ
- the tuple template to use for unificationpublic void remove(LogicTuple t)
ITupleSet
public int size()
ITupleSet
public LogicTuple[] toArray()
public java.lang.String toString()
ITupleSet
protected abstract java.lang.String getTupleKey1(LogicTuple t)
t
- the LogicTuple whose first key should be retrievedprotected abstract java.lang.String getTupleKey2(LogicTuple t)
t
- the LogicTuple whose second key should be retrieved