lights.adapters.tspaces
Class TupleAdapter

java.lang.Object
  |
  +--lights.adapters.tspaces.TupleAdapter
All Implemented Interfaces:
ITuple, java.io.Serializable

public class TupleAdapter
extends java.lang.Object
implements ITuple, java.io.Serializable

Implements the functionality described for lights.adapters.Tuple using TSpaces.

Version:
1.0
Author:
Gian Pietro Picco
See Also:
Tuple, TSpaces Web page, Serialized Form

Constructor Summary
TupleAdapter()
           
TupleAdapter(com.ibm.tspaces.Tuple tuple)
           
 
Method Summary
 ITuple add(IField field)
          Adds a field at the end of the tuple.
 ITuple addActual(java.io.Serializable obj)
          Adds an actual field, whose value is the given object, at the end of the tuple.
 ITuple addFormal(java.lang.Class classObj)
          Adds a formal field, whose type is the given class, at the end of the tuple.
 IField get(int index)
          Returns the field at position index.
 IField[] getFields()
          Returns all the fields in this tuple.
 ITuple insertAt(IField field, int index)
          Inserts the given field at position index.
 int length()
          Returns the number of fields in the tuple.
 boolean matches(ITuple tuple)
          Determines the rule used for pattern matching between tuples.
 ITuple removeAt(int index)
          Removes the field at position index.
 ITuple set(IField field, int index)
          Replaces the field at position index with the given one.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TupleAdapter

public TupleAdapter()

TupleAdapter

public TupleAdapter(com.ibm.tspaces.Tuple tuple)
Method Detail

add

public ITuple add(IField field)
Description copied from interface: ITuple
Adds a field at the end of the tuple.
Specified by:
add in interface ITuple
Following copied from interface: lights.interfaces.ITuple
Returns:
the resulting tuple.

addActual

public ITuple addActual(java.io.Serializable obj)
Description copied from interface: ITuple
Adds an actual field, whose value is the given object, at the end of the tuple. The type of the field is automatically set to the object's class.
Specified by:
addActual in interface ITuple
Following copied from interface: lights.interfaces.ITuple
Returns:
the resulting tuple.

addFormal

public ITuple addFormal(java.lang.Class classObj)
Description copied from interface: ITuple
Adds a formal field, whose type is the given class, at the end of the tuple.
Specified by:
addFormal in interface ITuple
Following copied from interface: lights.interfaces.ITuple
Returns:
the resulting tuple.

set

public ITuple set(IField field,
                  int index)
Description copied from interface: ITuple
Replaces the field at position index with the given one.
Specified by:
set in interface ITuple
Following copied from interface: lights.interfaces.ITuple
Returns:
the resulting tuple.

get

public IField get(int index)
Description copied from interface: ITuple
Returns the field at position index.
Specified by:
get in interface ITuple

insertAt

public ITuple insertAt(IField field,
                       int index)
Description copied from interface: ITuple
Inserts the given field at position index. All the fields whose position is greater than index are shifted downwards, i.e., their index is increased by one.
Specified by:
insertAt in interface ITuple
Following copied from interface: lights.interfaces.ITuple
Returns:
the resulting tuple.

removeAt

public ITuple removeAt(int index)
Description copied from interface: ITuple
Removes the field at position index. The fields whose position is greater than index are shifted upwards, i.e., their index is decreased by one.
Specified by:
removeAt in interface ITuple
Following copied from interface: lights.interfaces.ITuple
Returns:
the resulting tuple.

getFields

public IField[] getFields()
Description copied from interface: ITuple
Returns all the fields in this tuple.
Specified by:
getFields in interface ITuple
Following copied from interface: lights.interfaces.ITuple
Returns:
an array containing the fields of this tuple.

length

public int length()
Description copied from interface: ITuple
Returns the number of fields in the tuple.
Specified by:
length in interface ITuple

matches

public boolean matches(ITuple tuple)
Description copied from interface: ITuple
Determines the rule used for pattern matching between tuples. Classes implementing this interface may specify different policies for matching.
Specified by:
matches in interface ITuple
Following copied from interface: lights.interfaces.ITuple
Returns:
true if the tuple passed as a parameter matches this tuple, false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object