uk.ac.ic.doc.automed.wrappers
Class AutoMedTuple

java.lang.Object
  extended by uk.ac.ic.doc.automed.wrappers.AutoMedType
      extended by uk.ac.ic.doc.automed.wrappers.AutoMedTuple

public class AutoMedTuple
extends AutoMedType

A structure to hold one tuple of data, to be used by AutoMedResult as the basis for storing sets, lists or bags of tuples.

Author:
Peter McBrien (pjm@doc.ic.ac.uk)

Field Summary
private  AutoMedResult amr
           
private  AutoMedType[] data
           
private  int rowNumber
           
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedType
BOOLEAN, FLOAT, INTEGER, isNull, NULL_STR, STRING, TIME, TUPLE
 
Constructor Summary
AutoMedTuple(AutoMedResult amr, int i, int nc)
          Create a new tuple belonging to row i and with nc attributes
 
Method Summary
 double doubleValue()
          Return the arity (size) of the tuple as a double.
 boolean equals(AutoMedType v)
          Test two AutoMedTypes for equality, performing conversions as appropriate.
 AutoMedType getAttribute(int no)
          Return a particular attribute from a tuple (counting from one)
 int getAttributeType(int attributeNumber)
           
 AutoMedType[] getData()
          Return all the attributes of this tuple as an array
 int getInt(int i)
          Return a particular attribute from a tuple (counting from one) as a 32 bit integer
 java.lang.String getString(int i)
          Return a particular attribute from a tuple (counting from one) as a String
 int getType()
          Return the Type (INTEGER, TUPLE, ...) of this AutoMedType
 void setAttribute(int no, AutoMedType v)
          Set the value of a certain field
 int size()
           
 java.lang.String toString()
          Produce a string representation of the AutoMedTuple
 void toString(java.lang.StringBuffer r)
          Produce a string representation of the result set, where {} indicates a set of values, and [] a list of values
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedType
isLiteral, isNull, isNumeric
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rowNumber

private int rowNumber

data

private AutoMedType[] data

amr

private AutoMedResult amr
Constructor Detail

AutoMedTuple

public AutoMedTuple(AutoMedResult amr,
                    int i,
                    int nc)
Create a new tuple belonging to row i and with nc attributes

Method Detail

setAttribute

public void setAttribute(int no,
                         AutoMedType v)
                  throws DataSourceException
Set the value of a certain field

Throws:
DataSourceException

size

public int size()

getData

public AutoMedType[] getData()
Return all the attributes of this tuple as an array


getAttribute

public AutoMedType getAttribute(int no)
                         throws DataSourceException
Return a particular attribute from a tuple (counting from one)

Throws:
DataSourceException

getString

public java.lang.String getString(int i)
Return a particular attribute from a tuple (counting from one) as a String


doubleValue

public double doubleValue()
Return the arity (size) of the tuple as a double.

Specified by:
doubleValue in class AutoMedType

getInt

public int getInt(int i)
           throws DataSourceException
Return a particular attribute from a tuple (counting from one) as a 32 bit integer

Throws:
DataSourceException

toString

public void toString(java.lang.StringBuffer r)
Produce a string representation of the result set, where {} indicates a set of values, and [] a list of values


toString

public java.lang.String toString()
Produce a string representation of the AutoMedTuple

Specified by:
toString in class AutoMedType

getAttributeType

public int getAttributeType(int attributeNumber)

equals

public boolean equals(AutoMedType v)
Description copied from class: AutoMedType
Test two AutoMedTypes for equality, performing conversions as appropriate. Note that, unlike SQL but like Java, two null types will return true when compared.

Specified by:
equals in class AutoMedType

getType

public final int getType()
Description copied from class: AutoMedType
Return the Type (INTEGER, TUPLE, ...) of this AutoMedType

Specified by:
getType in class AutoMedType