All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.tspaces.SuperTuple

java.lang.Object
   |
   +----com.ibm.tspaces.SuperTuple

public abstract class SuperTuple
extends Object
implements Serializable
A SuperTuple is an ordered sequence of Fields. Since it's abstract, any SuperTuple is actually either a Tuple or a SubclassableTuple.

The standard matching algorithm for Tuples is based on structural equivalence. If two tuples (1) have the same number of Fields, (2) the fields are the same type, (3) fields with value (actuals) have the same value, and (4) fields without values (formals) are not matched against other formals, the tuples will match. For SubclassableTuples, the type (Class) of the target tuple must be a subclass of the Class of this tuple. (This implies that a Tuple will never match a SubclassableTuple, and vice versa.)

Author:
Daniel Ford, Tobin Lehman, Stephen McLaughry, Peter Wyckoff
See Also:
Tuple, SubclassableTuple, Field, TupleSpace

Constructor Index

 o SuperTuple()
The default SuperTuple constructor.
 o SuperTuple(Serializable)
Make a Tuple whose Field is the type and value of an Object.
 o SuperTuple(Serializable, Serializable)
Make a SuperTuple whose Fields are the type and value of Objects.
 o SuperTuple(Serializable, Serializable, Serializable)
Make a SuperTuple whose Fields are the type and value of Objects.
 o SuperTuple(Serializable, Serializable, Serializable, Serializable)
Make a SuperTuple whose Fields are the type and value of Objects.
 o SuperTuple(Serializable, Serializable, Serializable, Serializable, Serializable)
Make a SuperTuple whose Fields are the type and value of Objects.
 o SuperTuple(Serializable, Serializable, Serializable, Serializable, Serializable, Serializable)
Make a SuperTuple whose Fields are the type and value of Objects.
 o SuperTuple(Serializable, Serializable, Serializable, Serializable, Serializable, Serializable, Serializable)
Make a SuperTuple whose Fields are the type and value of Objects.

Method Index

 o add(Class)
Add a Field with the Class as its type (this is a "Formal" Field).
 o add(double)
Add a Field for the integral type "double" by wrapping it as a Double.
 o add(Field)
Add a Field to the SuperTuple.
 o add(float)
Add a Field for the integral type "float" by wrapping it as a Float.
 o add(int)
Add a Field for the integral type "int" by wrapping it as an Integer.
 o add(long)
Add a Field for the integral type "long" by wrapping it as an Long.
 o add(Serializable)
Add a Field with the Object as its value.
 o add(String)
Add a String Field to the Tuple.
 o add(String, Class)
Add a named Field with the Class as its type (this is a "Formal" Field).
 o add(String, double)
Add a named Field for the integral type "double" by wrapping it as a Double.
 o add(String, float)
Add a named Field for the integral type "float" by wrapping it as a Float.
 o add(String, int)
Add a named Field for the integral type "int" by wrapping it as an Integer.
 o add(String, long)
Add a Field for the integral type "long" by wrapping it as an Long.
 o add(String, Serializable)
Add a named Field with the Object as its value.
 o add(String, String)
Add a named String Field Tuple
 o changeName(String, String)
Change the name of the named field.
 o debugOut()
Print a string representation of the Tuple to standard out
 o fieldExists(String)
Return true if the named Field exists in the Tuple.
 o fields()
Return an enumeration of the Fields in the Tuple.
 o getField(int)
Return the i'th Field in the Tuple.
 o getField(String)
Return a named Field in the Tuple.
 o main(String[])
Test routine for Tuple
 o matches(SuperTuple)
Return true if the specified Tuple matches this Tuple.
 o numberOfFields()
Return the number of fields in the Tuple.
 o printOn(PrintStream)
Print the Fields of the Tuple on the PrintStream.
 o putField(Field, int)
Set the i'th Field.
 o setFormal(int)
Set the indexed Field to be formal
 o setFormal(String)
Set the named Field to be formal
 o setName(String, int)
Set the name of the indexed Field.
 o setType(String, Class)
Set the type of a named field to the Class passed.
 o setValue(int, Serializable)
Set the value of a field to the Object passed.
 o setValue(String, Serializable)
Set the value of a named field to the Object passed.
 o structureName()
Return a string representation of the Tuple's structure.
 o template()
Return true if the Tuple is a template. Deprecated.
 o toString()
Return a string representation of the Tuple.
 o uniqueId()
 o uniqueId(int)
Assign to the unique id.

Constructors

 o SuperTuple
 public SuperTuple()
The default SuperTuple constructor. Constructs a NULL SuperTuple, one with no Fields. Subsequent Fields can be added with the "add" method.

See Also:
add
 o SuperTuple
 public SuperTuple(Serializable obj) throws TupleSpaceException
Make a Tuple whose Field is the type and value of an Object. If the object itself is a Field, then it will be used as the Field and not as the Field's value.

Parameters:
obj - the value of the first Field of the Tuple.
 o SuperTuple
 public SuperTuple(Serializable obj1,
                   Serializable obj2) throws TupleSpaceException
Make a SuperTuple whose Fields are the type and value of Objects. If any object itself is a Field, then it will be used as the Field and not as the Field's value.

Parameters:
obj1 - the value of the first field of the SuperTuple.
obj2 - the value of the second field of the SuperTuple.
 o SuperTuple
 public SuperTuple(Serializable obj1,
                   Serializable obj2,
                   Serializable obj3) throws TupleSpaceException
Make a SuperTuple whose Fields are the type and value of Objects. If any object itself is a Field, then it will be used as the Field and not as the Field's value.

Parameters:
obj1 - the value of the first field of the SuperTuple.
obj2 - the value of the second field of the SuperTuple.
obj3 - the value of the third field of the SuperTuple.
 o SuperTuple
 public SuperTuple(Serializable obj1,
                   Serializable obj2,
                   Serializable obj3,
                   Serializable obj4) throws TupleSpaceException
Make a SuperTuple whose Fields are the type and value of Objects. If any object itself is a Field, then it will be used as the Field and not as the Field's value.

Parameters:
obj1 - the value of the first field of the SuperTuple.
obj2 - the value of the second field of the SuperTuple.
obj3 - the value of the third field of the SuperTuple.
obj4 - the value of the fourth field of the SuperTuple.
 o SuperTuple
 public SuperTuple(Serializable obj1,
                   Serializable obj2,
                   Serializable obj3,
                   Serializable obj4,
                   Serializable obj5) throws TupleSpaceException
Make a SuperTuple whose Fields are the type and value of Objects. If any object itself is a Field, then it will be used as the Field and not as the Field's value.

Parameters:
obj1 - the value of the first field of the SuperTuple.
obj2 - the value of the second field of the SuperTuple.
obj3 - the value of the third field of the SuperTuple.
obj4 - the value of the fourth field of the SuperTuple.
obj5 - the value of the fifth field of the SuperTuple.
 o SuperTuple
 public SuperTuple(Serializable obj1,
                   Serializable obj2,
                   Serializable obj3,
                   Serializable obj4,
                   Serializable obj5,
                   Serializable obj6) throws TupleSpaceException
Make a SuperTuple whose Fields are the type and value of Objects. If any object itself is a Field, then it will be used as the Field and not as the Field's value.

Parameters:
obj1 - the value of the first field of the SuperTuple.
obj2 - the value of the second field of the SuperTuple.
obj3 - the value of the third field of the SuperTuple.
obj4 - the value of the fourth field of the SuperTuple.
obj5 - the value of the fifth field of the SuperTuple.
obj6 - the value of the sixth field of the SuperTuple.
 o SuperTuple
 public SuperTuple(Serializable obj1,
                   Serializable obj2,
                   Serializable obj3,
                   Serializable obj4,
                   Serializable obj5,
                   Serializable obj6,
                   Serializable obj7) throws TupleSpaceException
Make a SuperTuple whose Fields are the type and value of Objects. If any object itself is a Field, then it will be used as the Field and not as the Field's value.

Parameters:
obj1 - the value of the first field of the SuperTuple.
obj2 - the value of the second field of the SuperTuple.
obj3 - the value of the third field of the SuperTuple.
obj4 - the value of the fourth field of the SuperTuple.
obj5 - the value of the fifth field of the SuperTuple.
obj6 - the value of the sixth field of the SuperTuple.
obj7 - the value of the seventh field of the SuperTuple.

Methods

 o add
 public void add(Field f_)
Add a Field to the SuperTuple. It is added to the "end" of the collection of the other Fields.

Parameters:
f_ - The Field to be added to the SuperTuple.
 o add
 public void add(Class class_) throws TupleSpaceException
Add a Field with the Class as its type (this is a "Formal" Field).

Parameters:
class_ - The type of the Field.
See Also:
Field, formal, Class
 o add
 public void add(String name,
                 Class t) throws TupleSpaceException
Add a named Field with the Class as its type (this is a "Formal" Field).

Parameters:
name - The name of the Field.
t - The type of the Field.
See Also:
Field, formal, Class
 o add
 public void add(Serializable obj_) throws TupleSpaceException
Add a Field with the Object as its value. The type of the Field will be the Class of the Object.

Parameters:
obj_ - The Object that is value of the new Field.
See Also:
Field
 o add
 public void add(String name,
                 Serializable obj_) throws TupleSpaceException
Add a named Field with the Object as its value. The type of the Field will be the Class of the Object.

Parameters:
name - The name of the Field.
obj_ - The Object that is value of the new Field.
See Also:
Field
 o add
 public void add(String value_) throws TupleSpaceException
Add a String Field to the Tuple.

Parameters:
value_ - A String that will be the value of the first Field of the Tuple.
 o add
 public void add(String name,
                 String value_) throws TupleSpaceException
Add a named String Field Tuple

Parameters:
name - The name of the Field.
value_ - A String that will be the value of the first Field of the Tuple.
 o add
 public void add(int i_) throws TupleSpaceException
Add a Field for the integral type "int" by wrapping it as an Integer.

Parameters:
i_ - The integer that is the value of the value of the Field in
See Also:
Field, Integer
 o add
 public void add(String name,
                 int i_) throws TupleSpaceException
Add a named Field for the integral type "int" by wrapping it as an Integer.

Parameters:
name - The name of the Field.
i_ - The integer that is the value of the value of the Field in
See Also:
Field, Integer
 o add
 public void add(long l_) throws TupleSpaceException
Add a Field for the integral type "long" by wrapping it as an Long.

Parameters:
l_ - The long that is the value of of the new Field in the Tuple.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field, Long
 o add
 public void add(String name,
                 long l_) throws TupleSpaceException
Add a Field for the integral type "long" by wrapping it as an Long.

Parameters:
name - The name of the Field.
l_ - The long that is the value of of the new Field in the Tuple.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field, Long
 o add
 public void add(double d_) throws TupleSpaceException
Add a Field for the integral type "double" by wrapping it as a Double.

Parameters:
d_ - The double that is the value of the new Field of the Tuple
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field, Double
 o add
 public void add(String name,
                 double d_) throws TupleSpaceException
Add a named Field for the integral type "double" by wrapping it as a Double.

Parameters:
name - The name of the Field.
d_ - The double that is the value of the new Field of the Tuple
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field, Double
 o add
 public void add(float f_) throws TupleSpaceException
Add a Field for the integral type "float" by wrapping it as a Float.

Parameters:
f_ - The float that is the value of the new Field of the Tuple.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field, Float
 o add
 public void add(String name,
                 float f_) throws TupleSpaceException
Add a named Field for the integral type "float" by wrapping it as a Float.

Parameters:
name - The name of the Field.
f_ - The float that is the value of the new Field of the Tuple.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field, Float
 o setType
 public void setType(String name,
                     Class t) throws TupleSpaceException
Set the type of a named field to the Class passed. The old value of the Field is discarded.

Parameters:
name - The name of the Field.
t - The new type of the field.
Throws: TupleSpaceException
If no Field in the Tuple exists with the given name.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o setValue
 public void setValue(String name,
                      Serializable v) throws TupleSpaceException
Set the value of a named field to the Object passed. The value of the Field is the Class of the Object.

Parameters:
name - The name of the Field.
v - The new value of the field.
Throws: TupleSpaceException
If no Field in the Tuple exists with the given name.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o setValue
 public void setValue(int i,
                      Serializable v) throws TupleSpaceException
Set the value of a field to the Object passed. The value of the Field is the Class of the Object.

Parameters:
i - The # of the Field.
v - The new value of the field.
Throws: TupleSpaceException
If no Field in the Tuple exists with the given name.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o setName
 public void setName(String name,
                     int i) throws TupleSpaceException
Set the name of the indexed Field.

Parameters:
name - The new name of the Field.
i - The index of the field.
Throws: TupleSpaceException
If no Field at position i of the Tuple..
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o setFormal
 public void setFormal(int i) throws TupleSpaceException
Set the indexed Field to be formal

Parameters:
i - The index of the field.
Throws: TupleSpaceException
If no Field at position i of the Tuple..
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o setFormal
 public void setFormal(String name) throws TupleSpaceException
Set the named Field to be formal

Parameters:
name - The name of the Field.
Throws: TupleSpaceException
If no Field at position i of the Tuple..
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o changeName
 public void changeName(String oldName,
                        String newName) throws TupleSpaceException
Change the name of the named field.

Parameters:
oldName - The old name of the Field.
newName - The new name of the Field.
Throws: TupleSpaceException
If no Field in the Tuple exists with the given name.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o putField
 public void putField(Field f,
                      int i) throws TupleSpaceException
Set the i'th Field.

Parameters:
f - The new Field.
i - The position in the Tuple for the new Field.
Throws: TupleSpaceException
If no Field at position i of the Tuple..
See Also:
Field
 o getField
 public Field getField(int i) throws TupleSpaceException
Return the i'th Field in the Tuple.

Parameters:
i - The position of the Field in the Tuple
Returns:
The Field at position i.
Throws: TupleSpaceException
If no Field at position i of the Tuple.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o getField
 public Field getField(String name) throws TupleSpaceException
Return a named Field in the Tuple.

Parameters:
name - The name of the Field in the Tuple.
Returns:
The named Field.
Throws: TupleSpaceException
If no Field in the Tuple exists with the given name.
Throws: TupleSpaceException
if there is a problem creating the fields
See Also:
Field
 o fields
 public Enumeration fields()
Return an enumeration of the Fields in the Tuple.

Returns:
An Enumeration.
See Also:
Field
 o numberOfFields
 public int numberOfFields()
Return the number of fields in the Tuple.

Returns:
The number of Fields in the Tuple.
See Also:
Field
 o uniqueId
 public int uniqueId()
Returns:
the unique id assigned to this tuple by its TSDB (id unique only inside the DB)
 o uniqueId
 public void uniqueId(int id)
Assign to the unique id. Should only be called by TSDB on an insert and when ids need to be reshuffled.

 o matches
 public boolean matches(SuperTuple t_)
Return true if the specified Tuple matches this Tuple. A pair of Tuples match if each of their corresponding Fields match.

Parameters:
t_ - The Tuple to compare.
Returns:
true if the Tuples are equal, false otherwise.
See Also:
equals
 o template
 public boolean template()
Note: template() is deprecated. Since we no longer differentiate between "formal" and "actual" tuples, this is no longer useful.

Return true if the Tuple is a template. A Tuple is a template if it has at least one formal Field.

Returns:
true if the Tuple has at least one formal Field
 o fieldExists
 public boolean fieldExists(String name)
Return true if the named Field exists in the Tuple.

Parameters:
name - The name of the Field to look for.
Returns:
true if the Tuple has a Field with the passed name.
 o structureName
 public String structureName()
Return a string representation of the Tuple's structure.

Returns:
String representation of the Tuple's structure.
 o toString
 public String toString()
Return a string representation of the Tuple.

Returns:
String representation of the Tuple.
Overrides:
toString in class Object
 o printOn
 public void printOn(PrintStream pout)
Print the Fields of the Tuple on the PrintStream.

 o debugOut
 public void debugOut()
Print a string representation of the Tuple to standard out

 o main
 public static void main(String argv[])
Test routine for Tuple


All Packages  Class Hierarchy  This Package  Previous  Next  Index