All Packages Class Hierarchy This Package Previous Next Index
Class macondo.mistero.collections.TupleCollection
macondo.mistero.collections.TupleCollection
- public class TupleCollection
A TupleCollection
represents a group of tuples with the
same pattern inside a tuple space. Tuples can be added to a collection
and then read or withdrawn with an iterator in the same order they have
been inserted.
-
TupleCollection(Space, Tuple)
- Builds a new
TupleCollection
.
-
add(Tuple)
- Adds a tuple to this collection.
-
contains(Tuple)
- Tests if this collection contains the specified tuple.
-
inIterator()
- Returns a InIterator on this collection.
-
isEmpty()
- Tests if this collection contains no element.
-
readIterator()
- Returns a ReadIterator on this collection.
TupleCollection
public TupleCollection(Space space,
Tuple pattern)
- Builds a new
TupleCollection
.
- Parameters:
- space - the tuple space of the collection.
- token - the token used to enumerate tuples.
- pattern - the pattern of tuples in this collection.
add
public void add(Tuple tuple) throws IllegalTupleException
- Adds a tuple to this collection. The tuple is added if and only
if it matches the pattern of this collection, otherwise an
exception is thrown.
- Parameters:
- tuple - the tuple inserted in this collection.
- Throws: IllegalTupleException
- thrown if the specified tuple
doesn't match the pattern of the collection.
readIterator
public TupleIterator readIterator()
- Returns a ReadIterator on this collection.
- Returns:
- a ReadIterator on this collection.
- See Also:
- TupleIterator, ReadIterator
inIterator
public TupleIterator inIterator()
- Returns a InIterator on this collection.
- Returns:
- a InIterator on this collection.
- See Also:
- TupleIterator, InIterator
isEmpty
public boolean isEmpty() throws SpaceException
- Tests if this collection contains no element.
- Returns:
-
true
if this collection contains no element,
false
otherwise.
- Throws: SpaceException
- thrown if an error occurs accessing
the tuple space.
contains
public boolean contains(Tuple tuple) throws SpaceException
- Tests if this collection contains the specified tuple.
- Parameters:
- tuple - tuple whose presence is to be tested.
- Returns:
-
true
if the tuple is present in this
collection, false
otherwise.
- Throws: SpaceException
- thrown if an error occurs accessing
the tuple space.
All Packages Class Hierarchy This Package Previous Next Index