lights.interfaces
Interface ITupleSpace

All Known Implementing Classes:
TupleSpace, TupleSpace

public interface ITupleSpace

Defines the operations available on a tuple space. The traditional operations provided by Linda, namely the insertion of a tuple with out and pattern matching with the blocking operations in and rd, are supported. In addition, the following features are provided:

Version:
1.0
Author:
Gian Pietro Picco

Field Summary
static java.lang.String DEFAULT_NAME
          The default name of a tuple space.
 
Method Summary
 int count(ITuple template)
          Returns a count of the tuples found in the tuple space that match the template.
 java.lang.String getName()
          Returns the name of the tuple space.
 ITuple in(ITuple template)
          Withdraws from the tuple space a tuple matching the template specified; if no tuple is found, the caller is suspended until such a tuple shows up in the tuple space.
 ITuple[] ing(ITuple template)
          Withdraws from the tuple space all the tuple matching the template specified.
 ITuple inp(ITuple template)
          Withdraws from the tuple space a tuple matching the template specified; if no tuple is found, null is returned.
 void out(ITuple tuple)
          Inserts a tuple in the tuple space.
 void outg(ITuple[] tuples)
          Inserts multiple tuples in the tuple space.
 ITuple rd(ITuple template)
          Reads from the tuple space a copy of a tuple matching the template specified.
 ITuple[] rdg(ITuple template)
          Reads from the tuple space a copy of all the tuples matching the template specified.
 ITuple rdp(ITuple template)
          Reads from the tuple space a copy of a tuple matching the template specified.
 

Field Detail

DEFAULT_NAME

public static final java.lang.String DEFAULT_NAME
The default name of a tuple space.
Method Detail

getName

public java.lang.String getName()
Returns the name of the tuple space.

out

public void out(ITuple tuple)
         throws TupleSpaceException
Inserts a tuple in the tuple space. Note how different implementations may specify different atomicity requirements.
Parameters:
tuple - The tuple to be inserted.
Throws:
TupleSpaceException - if an error occurs in the implementation.

outg

public void outg(ITuple[] tuples)
          throws TupleSpaceException
Inserts multiple tuples in the tuple space. Note how different implementations may specify different atomicity requirements.
Parameters:
tuples - An array containing the tuples to be inserted.
Throws:
TupleSpaceException - if an error occurs in the implementation.

in

public ITuple in(ITuple template)
          throws TupleSpaceException
Withdraws from the tuple space a tuple matching the template specified; if no tuple is found, the caller is suspended until such a tuple shows up in the tuple space. Note how different implementations may specify different policies for the selection of the tuple returned among multiple matches.
Parameters:
template - the template used for matching.
Returns:
a tuple matching the template.
Throws:
TupleSpaceException - if an error in the implementation.

inp

public ITuple inp(ITuple template)
           throws TupleSpaceException
Withdraws from the tuple space a tuple matching the template specified; if no tuple is found, null is returned. Note how different implementations may specify different policies for the selection of the tuple returned among multiple matches.
Parameters:
template - the template used for matching.
Returns:
a tuple matching the template, or null if none is found.
Throws:
TupleSpaceException - if an error in the implementation.

ing

public ITuple[] ing(ITuple template)
             throws TupleSpaceException
Withdraws from the tuple space all the tuple matching the template specified. If no tuple is found, null is returned.
Parameters:
template - the template used for matching.
Returns:
a tuple matching the template, or null if none is found.
Throws:
TupleSpaceException - if an error in the implementation.

rd

public ITuple rd(ITuple template)
          throws TupleSpaceException
Reads from the tuple space a copy of a tuple matching the template specified. If no tuple is found, the caller is suspended until such a tuple shows up in the tuple space. Note how different implementations may specify different policies for the selection of the tuple returned among multiple matches.
Parameters:
template - the template used for matching.
Returns:
a copy of a tuple matching the template.
Throws:
TupleSpaceException - if an error in the implementation.

rdp

public ITuple rdp(ITuple template)
           throws TupleSpaceException
Reads from the tuple space a copy of a tuple matching the template specified. If no tuple is found, null is returned. Note how different implementations may specify different policies for the selection of the tuple returned among multiple matches.
Parameters:
template - the template used for matching.
Returns:
a copy of a tuple matching the template.
Throws:
TupleSpaceException - if an error in the implementation.

rdg

public ITuple[] rdg(ITuple template)
             throws TupleSpaceException
Reads from the tuple space a copy of all the tuples matching the template specified. If no tuple is found, null is returned.\
Parameters:
template - the template used for matching.
Returns:
a copy of a tuple matching the template.
Throws:
TupleSpaceException - if an error in the implementation.

count

public int count(ITuple template)
          throws TupleSpaceException
Returns a count of the tuples found in the tuple space that match the template.
Parameters:
template - the template used for matching.
Returns:
the number of tuples currently in the tuple space that match the template.
Throws:
TupleSpaceException - if an error in the implementation.