org.objectweb.medor.query.lib

Class MedorTCQueryLeaf

Implemented Interfaces:
Cloneable, Cloneable, QueryLeaf, QueryTree, TCQueryLeaf, TupleStructure

public class MedorTCQueryLeaf
extends BasicTupleStructure
implements TCQueryLeaf

A TupleCollection is one of the DataStore that is queryable by Medor.

This class reprensents a QueryLeaf wich take its data from a Medor TupleCollection.

Field Summary

protected DataStore
ds
protected Expression
filter
protected TupleLoader
loader
protected String
nodeName
protected TupleCollection
tcData

Fields inherited from class org.objectweb.medor.lib.BasicTupleStructure

fields, logger, name2field

Constructor Summary

MedorTCQueryLeaf()
MedorTCQueryLeaf(String nodeName, String tcName, TupleCollection tcData)

Method Summary

QueryTreeField
addField(String fieldName, PType type, Field tcField)
Object
clone(Object clone, Map obj2clone)
DataStore
getDataStore()
boolean
getDistinct()
Tests whether the results should be distinct or not.
String
getName()
It returns the name of the query tree.
OrderField[]
getOrderBy()
Returns the array of OrderFields indicating how the result should be ordered.
Expression
getQueryFilter()
TupleCollection
getTupleCollection()
TupleLoader
getTupleLoader()
TupleStructure
getTupleStructure()
Returns the TupleStructure associated to the QueryTree.
void
setDistinct(boolean d)
Indicates whether evaluating the QueryTree should return unique results (duplicate elimination) or not.
void
setOrderBy(OrderField[] orderfields)
Sets the OrderBy array of OrderFields.
void
setQueryFilter(Expression filter)
void
setTupleLoader(TupleLoader tl)

Methods inherited from class org.objectweb.medor.lib.BasicTupleStructure

clone, contains, contains, getField, getField, getFieldRank, getFields, getSize

Field Details

ds

protected DataStore ds


filter

protected Expression filter


loader

protected TupleLoader loader


nodeName

protected String nodeName


tcData

protected TupleCollection tcData

Constructor Details

MedorTCQueryLeaf

public MedorTCQueryLeaf()


MedorTCQueryLeaf

public MedorTCQueryLeaf(String nodeName,
                        String tcName,
                        TupleCollection tcData)
            throws MedorException

Method Details

addField

public QueryTreeField addField(String fieldName,
                               PType type,
                               Field tcField)
            throws MedorException
Specified by:
addField in interface TCQueryLeaf


clone

public Object clone(Object clone,
                    Map obj2clone)
            throws CloneNotSupportedException
Overrides:
clone in interface BasicTupleStructure


getDataStore

public DataStore getDataStore()
Specified by:
getDataStore in interface QueryLeaf


getDistinct

public boolean getDistinct()
Tests whether the results should be distinct or not.
Specified by:
getDistinct in interface QueryTree

Returns:
true if there results should be distinct, false otherwise.


getName

public String getName()
It returns the name of the query tree.
Specified by:
getName in interface QueryTree


getOrderBy

public OrderField[] getOrderBy()
Returns the array of OrderFields indicating how the result should be ordered.
Specified by:
getOrderBy in interface QueryTree

Returns:
the array of OrderFields.


getQueryFilter

public Expression getQueryFilter()
Specified by:
getQueryFilter in interface TCQueryLeaf


getTupleCollection

public TupleCollection getTupleCollection()
Specified by:
getTupleCollection in interface TCQueryLeaf


getTupleLoader

public TupleLoader getTupleLoader()
Specified by:
getTupleLoader in interface TCQueryLeaf


getTupleStructure

public TupleStructure getTupleStructure()
Returns the TupleStructure associated to the QueryTree. Note that the Fields cannot be added by manipulating the TupleStructure, but by using either constructors in the case of a QueryLeaf, or by using the addXXXFields methods in the case of QueryNodes.
Specified by:
getTupleStructure in interface QueryTree


setDistinct

public void setDistinct(boolean d)
            throws MedorException
Indicates whether evaluating the QueryTree should return unique results (duplicate elimination) or not.

The default should be that duplicates are not eliminated (distinct is false).

Specified by:
setDistinct in interface QueryTree

Parameters:

Throws:
MedorException - if the distinct operation is not supported.


setOrderBy

public void setOrderBy(OrderField[] orderfields)
            throws MedorException
Sets the OrderBy array of OrderFields.

This array indicates the fields by which the results should be ordered.

Like for filters assigned to QueryNodes, the Fields used for ordering must belong to children of the current QueryTree.

A noticeable exception is the case of RdbExpQueryLeaves, where ordering fields are fields of the QueryLeaf itself.

Specified by:
setOrderBy in interface QueryTree

Parameters:

Throws:
MedorException - if ordering is not supported.


setQueryFilter

public void setQueryFilter(Expression filter)
Specified by:
setQueryFilter in interface TCQueryLeaf


setTupleLoader

public void setTupleLoader(TupleLoader tl)
Specified by:
setTupleLoader in interface TCQueryLeaf