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.


Constructor Index

 o TupleCollection(Space, Tuple)
Builds a new TupleCollection.

Method Index

 o add(Tuple)
Adds a tuple to this collection.
 o contains(Tuple)
Tests if this collection contains the specified tuple.
 o inIterator()
Returns a InIterator on this collection.
 o isEmpty()
Tests if this collection contains no element.
 o readIterator()
Returns a ReadIterator on this collection.

Constructors

 o 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.

Methods

 o 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.
 o readIterator
 public TupleIterator readIterator()
Returns a ReadIterator on this collection.

Returns:
a ReadIterator on this collection.
See Also:
TupleIterator, ReadIterator
 o inIterator
 public TupleIterator inIterator()
Returns a InIterator on this collection.

Returns:
a InIterator on this collection.
See Also:
TupleIterator, InIterator
 o 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.
 o 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