theseus.api
Class Tuple

java.lang.Object
  |
  +--theseus.api.Tuple
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, theseus.api.StreamableDataObject

public class Tuple
extends java.lang.Object
implements theseus.api.StreamableDataObject

Tuples consist of a list of attributes and a list of values. A value at position 0 corresponds to the attribute at position 0 of the attribute list.

See Also:
Serialized Form

Field Summary
static java.lang.String DATA_VALUE_DELIM
           
static java.lang.Object NULL_VALUE
           
 
Constructor Summary
Tuple(theseus.api.AttrList a_attrList)
          Create tuple using an attribute list (all values initialized to null).
Tuple(theseus.api.AttrList a_attrList, java.lang.Object[] a_values)
          Create tuple using attribute list and object array values.
Tuple(theseus.api.AttrList a_attrList, java.lang.String a_values)
          Create tuple using attribute list and string values.
Tuple(java.lang.String a_attrList, java.lang.String a_values)
          Create tuple using attribute list and string values.
 
Method Summary
 void addAttrAndValue(java.lang.String a_attr, java.lang.Object a_val)
          Adds an attribute and its associated value.
 java.lang.String attrAndValuesToString()
          String that consists of attribute names and tuple values.
 java.lang.Object clone()
          Deep-copies a tuple.
 boolean distinct(theseus.api.Tuple t)
          Returns TRUE if all tuples are unique along ALL attributes.
 boolean distinct(theseus.api.Tuple t, int[] pos)
          Returns TRUE if all tuples are unique along attributes in specified positions.
 boolean equals(theseus.api.Tuple t)
          Returns TRUE if all values of the two tuples are equal.
 theseus.api.AttrList getAttrList()
          Sets the attribute list of the tuple.
 theseus.api.ConfirmTagList getConfirmTagList()
          For research purposes: do not use.
 java.lang.Object getValue(java.lang.String a_attr)
          Gets the value of an attribute indexed by name.
 java.lang.Object getValueAtPosition(int a_pos)
          Gets the value of an attribute indexed by position.
 java.lang.Object[] getValues()
          Gets the values of all attributes (in the same order as the attribute list).
 boolean isNull()
          Returns TRUE if all attribute values are NULL.
 boolean isSpeculative()
          For research purposes: do not use.
 void join(theseus.api.Tuple a_tup)
          Joins two tuples without any conditions.
 void project(theseus.api.AttrList a_attrList)
          Removes specified attributes (and their values) from a tuple.
 void removeAttr(java.lang.String a_attr)
          Removes an attribute.
 void setAttrList(theseus.api.AttrList a_attrList)
          Sets the values of all attributes (in the same order as the attribute list).
 void setConfirmTagList(theseus.api.ConfirmTagList a_ctl)
          For research purposes: do not use.
 void setValue(java.lang.String a_attr, java.lang.Object a_value)
          Sets the value of a particular attribute indexed by name.
 void setValueAtPosition(int a_pos, java.lang.Object a_obj)
          Sets the value of a particular attribute indexed by position.
 void setValues(java.lang.Object[] a_values)
          Sets the values of all attributes (in the same order as the attribute list).
 void setValues(java.lang.String a_values)
          Sets the values of all attributes (in the same order as the attribute list) using the "Foo|Bar" style string notation so that multiple values can be separated with the "|" delimiter.
 java.lang.String toString()
          String that consists of tuple values (not attribute names - use attrAndValuesToString() for that).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA_VALUE_DELIM

public static java.lang.String DATA_VALUE_DELIM

NULL_VALUE

public static java.lang.Object NULL_VALUE
Constructor Detail

Tuple

public Tuple(theseus.api.AttrList a_attrList)
Create tuple using an attribute list (all values initialized to null).


Tuple

public Tuple(theseus.api.AttrList a_attrList,
             java.lang.String a_values)
      throws theseus.api.InvalidTupleValuesException
Create tuple using attribute list and string values.


Tuple

public Tuple(java.lang.String a_attrList,
             java.lang.String a_values)
      throws theseus.api.InvalidTupleValuesException
Create tuple using attribute list and string values. For example, the following is possible: new Tuple("name char, age number", "Joe|25")


Tuple

public Tuple(theseus.api.AttrList a_attrList,
             java.lang.Object[] a_values)
Create tuple using attribute list and object array values.

Method Detail

isSpeculative

public boolean isSpeculative()
For research purposes: do not use.

Specified by:
isSpeculative in interface theseus.api.StreamableDataObject

setConfirmTagList

public void setConfirmTagList(theseus.api.ConfirmTagList a_ctl)
For research purposes: do not use.


getConfirmTagList

public theseus.api.ConfirmTagList getConfirmTagList()
For research purposes: do not use.


getAttrList

public theseus.api.AttrList getAttrList()
Sets the attribute list of the tuple.


setValues

public void setValues(java.lang.String a_values)
               throws theseus.api.InvalidTupleValuesException
Sets the values of all attributes (in the same order as the attribute list) using the "Foo|Bar" style string notation so that multiple values can be separated with the "|" delimiter.

theseus.api.InvalidTupleValuesException

setAttrList

public void setAttrList(theseus.api.AttrList a_attrList)
Sets the values of all attributes (in the same order as the attribute list).


setValues

public void setValues(java.lang.Object[] a_values)
Sets the values of all attributes (in the same order as the attribute list).


getValues

public java.lang.Object[] getValues()
Gets the values of all attributes (in the same order as the attribute list).


getValueAtPosition

public java.lang.Object getValueAtPosition(int a_pos)
Gets the value of an attribute indexed by position.


getValue

public java.lang.Object getValue(java.lang.String a_attr)
Gets the value of an attribute indexed by name.


setValueAtPosition

public void setValueAtPosition(int a_pos,
                               java.lang.Object a_obj)
Sets the value of a particular attribute indexed by position.


setValue

public void setValue(java.lang.String a_attr,
                     java.lang.Object a_value)
Sets the value of a particular attribute indexed by name.


equals

public boolean equals(theseus.api.Tuple t)
Returns TRUE if all values of the two tuples are equal.


distinct

public boolean distinct(theseus.api.Tuple t,
                        int[] pos)
Returns TRUE if all tuples are unique along attributes in specified positions.


distinct

public boolean distinct(theseus.api.Tuple t)
Returns TRUE if all tuples are unique along ALL attributes.


isNull

public boolean isNull()
Returns TRUE if all attribute values are NULL.


toString

public java.lang.String toString()
String that consists of tuple values (not attribute names - use attrAndValuesToString() for that).

Overrides:
toString in class java.lang.Object

attrAndValuesToString

public java.lang.String attrAndValuesToString()
String that consists of attribute names and tuple values.


clone

public java.lang.Object clone()
Deep-copies a tuple.

Specified by:
clone in interface theseus.api.StreamableDataObject
Overrides:
clone in class java.lang.Object

join

public void join(theseus.api.Tuple a_tup)
Joins two tuples without any conditions.


addAttrAndValue

public void addAttrAndValue(java.lang.String a_attr,
                            java.lang.Object a_val)
Adds an attribute and its associated value. The "attr" string should be of the form "[name] [attr_type]", for example "name char".


removeAttr

public void removeAttr(java.lang.String a_attr)
Removes an attribute.


project

public void project(theseus.api.AttrList a_attrList)
Removes specified attributes (and their values) from a tuple.