org.objectweb.medor.tuple.api

Interface TupleCollection

Known Subinterfaces:
BinaryEvaluatedTC, CachedTupleCollection
Known Implementing Classes:
BasicBinaryEvalutedTC, BinaryImplicitTC, CartesianEvaluatedTC, EmptyTupleCollection, ExplicitTupleCollection, JDBCTupleCollection, NestEvaluatedTC, ProjectEvaluatedTC, SelProjEvaluatedTC, UnnestEvaluatedTC, WindowCachedTupleCollection

public interface TupleCollection

This interface represent collections of tuples wich are manipulated by MEDOR.

A TupleCollection is a set of data typically representing the result of querying a data source result. Like JDBC ResultSets, a TupleCollection is scrollable over iteration methods. The number, types and properties of a TupleCollection object's attribute are provided by the TupleStructure object returned by the TupleCollection.getMetaData() method.

For example, to print all values of the first attribute of a TupleCollection tc : while (!tci.isLast()){
System.out.println(tci.getJavaObject(1)); tci.next();
}
Methods are provided to enumerate through the attributes of the TupleCollection This Interface represent also the data flow in the Query Tree wich also represents the result of a query.

Method Summary

void
close()
It closes the TupleCollection, relaeases used resources (example : ResultSet).
void
first()
Moves the cursor to the first Tuple, row number 1.
TupleStructure
getMetaData()
Retrieves the number,types and stors properties of the data sources of this TupleCollection Object.
int
getRow()
Retrieves the current row Number.
Tuple
getTuple()
Returns the Tuple value of the current row of this TupleCollection object.
Tuple
getTuple(int row)
Returns the Tuple value of the designeted row of this TupleCollection object.
boolean
isEmpty()
Tell whether the current TupleCollection Object is empty or no.
boolean
isLast()
Indicates whether the cursor is on the last row of this TupleCollection object.
boolean
next()
Moves the cursor down one row from its current position to the next tuple of this TupleCollection object.
boolean
row(int row)
Moves the cursor to the given row number in this TupleCollection object.

Method Details

close

public void close()
            throws MedorException
It closes the TupleCollection, relaeases used resources (example : ResultSet). The next uses of the TupleCollection will throw an exception.


first

public void first()
            throws MedorException
Moves the cursor to the first Tuple, row number 1.

Throws:
MedorException - if data source access error


getMetaData

public TupleStructure getMetaData()
            throws MedorException
Retrieves the number,types and stors properties of the data sources of this TupleCollection Object.

Returns:
a TupleCollectionMetaData Object defining teh TupleCollection.

Throws:
MedorException - if a data source access error occurs


getRow

public int getRow()
            throws MedorException
Retrieves the current row Number.

Returns:
-1 if the iterator is out of bounds of the TupleCollection or if it is empty.

Throws:
MedorException - if data source access error.


getTuple

public Tuple getTuple()
            throws MedorException
Returns the Tuple value of the current row of this TupleCollection object.

Returns:
the value of the current Tuple.

Throws:
MedorException - if data source access error.


getTuple

public Tuple getTuple(int row)
            throws MedorException
Returns the Tuple value of the designeted row of this TupleCollection object.

Parameters:
row - :int

Returns:
the a Tuple Number row.

Throws:
MedorException - if data source access error.


isEmpty

public boolean isEmpty()
            throws MedorException
Tell whether the current TupleCollection Object is empty or no.

Returns:
true if the TupleCollection is empty.

Throws:
MedorException - if data source access error.


isLast

public boolean isLast()
            throws MedorException
Indicates whether the cursor is on the last row of this TupleCollection object.

Returns:
true if the current Tuple is the last one or if the TupleCollection is Empty.

Throws:
MedorException - if data source access error


next

public boolean next()
            throws MedorException
Moves the cursor down one row from its current position to the next tuple of this TupleCollection object.

Returns:
true if move is impossible and false if move is not performed.

Throws:
MedorException - if data source access error


row

public boolean row(int row)
            throws MedorException
Moves the cursor to the given row number in this TupleCollection object. The first row is row 1, the second is row 2, and so on.

Returns:
true if move is possible

Throws:
MedorException - if row number is invelid or data source access error