alice.respect
Class TupleSetImpl

java.lang.Object
  |
  +--alice.respect.TupleSetImpl
All Implemented Interfaces:
java.io.Serializable, TupleSet

public class TupleSetImpl
extends java.lang.Object
implements TupleSet

Naive implementation of the TupleSet interface, defining the behaviour of the component managin tuple storage.

See Also:
Serialized Form

Constructor Summary
TupleSetImpl()
           
 
Method Summary
 void add(Tuple t)
          Adds a tuple to the multiset
 void beginTransaction()
          Begins a transaction section Every operation on multiset can be undone
 void empty()
          Empties the multiset
 void endTransaction(boolean commit)
          Ends a transaction section specifying if operations must be committed or undone
 java.util.Iterator getIterator()
          Gets an iterator to navigate through tuples of the multiset
 Tuple getMatchingTuple(TupleTemplate templ)
          Gets (and removes) non-deterministically a tuple of the multiset matching the template specified
 boolean hasMatchingTuple(TupleTemplate templ)
          Checks if exists a tuple inside the tuple set matching the template
 boolean isEmpty()
          Tests if the multiset is empty
 Tuple readMatchingTuple(TupleTemplate templ)
          Gets (wtihout removal) non-deterministically a tuple of the multiset matching the template specified
 int size()
          Gets the number of tuples inside the multiset
 void sub(Tuple t)
          Removes a tuple to the multiset
 java.lang.Object[] toArray()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TupleSetImpl

public TupleSetImpl()
Method Detail

add

public void add(Tuple t)
Description copied from interface: TupleSet
Adds a tuple to the multiset
Specified by:
add in interface TupleSet
Following copied from interface: alice.tuplemedium.TupleSet
Parameters:
t - the tuple to be added

sub

public void sub(Tuple t)
Description copied from interface: TupleSet
Removes a tuple to the multiset
Specified by:
sub in interface TupleSet
Following copied from interface: alice.tuplemedium.TupleSet
Parameters:
t - the tuple to be removed

isEmpty

public boolean isEmpty()
Description copied from interface: TupleSet
Tests if the multiset is empty
Specified by:
isEmpty in interface TupleSet

size

public int size()
Description copied from interface: TupleSet
Gets the number of tuples inside the multiset
Specified by:
size in interface TupleSet

beginTransaction

public void beginTransaction()
Description copied from interface: TupleSet
Begins a transaction section Every operation on multiset can be undone
Specified by:
beginTransaction in interface TupleSet

endTransaction

public void endTransaction(boolean commit)
Description copied from interface: TupleSet
Ends a transaction section specifying if operations must be committed or undone
Specified by:
endTransaction in interface TupleSet
Following copied from interface: alice.tuplemedium.TupleSet
Parameters:
commit - if true the operations are committed, else they are undone and the multiset is rolled back to the state before the beginTransaction invocation

empty

public void empty()
Description copied from interface: TupleSet
Empties the multiset
Specified by:
empty in interface TupleSet

getMatchingTuple

public Tuple getMatchingTuple(TupleTemplate templ)
Description copied from interface: TupleSet
Gets (and removes) non-deterministically a tuple of the multiset matching the template specified
Specified by:
getMatchingTuple in interface TupleSet
Following copied from interface: alice.tuplemedium.TupleSet
Parameters:
t - the tuple template to be used for the matching
Returns:
a tuple matching the template or null if no tuples found

readMatchingTuple

public Tuple readMatchingTuple(TupleTemplate templ)
Description copied from interface: TupleSet
Gets (wtihout removal) non-deterministically a tuple of the multiset matching the template specified
Specified by:
readMatchingTuple in interface TupleSet
Following copied from interface: alice.tuplemedium.TupleSet
Parameters:
t - the tuple template to be used for the matching
Returns:
a tuple matching the template or null if no tuples found

hasMatchingTuple

public boolean hasMatchingTuple(TupleTemplate templ)
Description copied from interface: TupleSet
Checks if exists a tuple inside the tuple set matching the template
Specified by:
hasMatchingTuple in interface TupleSet
Following copied from interface: alice.tuplemedium.TupleSet
Parameters:
t - the tuple template to be used for the matching
Returns:
true if a masching is found, false otherwise

getIterator

public java.util.Iterator getIterator()
Description copied from interface: TupleSet
Gets an iterator to navigate through tuples of the multiset
Specified by:
getIterator in interface TupleSet
Following copied from interface: alice.tuplemedium.TupleSet
Returns:
the iterator

toArray

public java.lang.Object[] toArray()