simpledb
Class Tuple

java.lang.Object
  extended by simpledb.Tuple

public class Tuple
extends java.lang.Object

Tuple maintains information about the contents of a tuple. Tuples have a specified schema specified by a TupleDesc object and contain Field objects with the data for each field.


Constructor Summary
Tuple(TupleDesc td)
          Create a new tuple with the specified schema (type).
 
Method Summary
 Field getField(int i)
           
 RecordId getRecordId()
           
 TupleDesc getTupleDesc()
           
 void setField(int i, Field f)
          Change the value of the ith field of this tuple.
 void setRecordId(RecordId rid)
          Set the RecordId information for this tuple.
 java.lang.String toString()
          Returns the contents of this Tuple as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tuple

public Tuple(TupleDesc td)
Create a new tuple with the specified schema (type).

Parameters:
td - the schema of this tuple. It must be a valid TupleDesc instance with at least one field.
Method Detail

getTupleDesc

public TupleDesc getTupleDesc()
Returns:
The TupleDesc representing the schema of this tuple.

getRecordId

public RecordId getRecordId()
Returns:
The RecordId representing the location of this tuple on disk. May be null.

setRecordId

public void setRecordId(RecordId rid)
Set the RecordId information for this tuple.

Parameters:
rid - the new RecordId for this tuple.

setField

public void setField(int i,
                     Field f)
Change the value of the ith field of this tuple.

Parameters:
i - index of the field to change. It must be a valid index.
f - new value for the field.

getField

public Field getField(int i)
Parameters:
i - field index to return. Must be a valid index.
Returns:
the value of the ith field, or null if it has not been set.

toString

public java.lang.String toString()
Returns the contents of this Tuple as a string. Note that to pass the system tests, the format needs to be as follows: column1\tcolumn2\tcolumn3\t...\tcolumnN\n where \t is any whitespace, except newline, and \n is a newline

Overrides:
toString in class java.lang.Object