org.objectweb.medor.query.lib
Class MedorTCQueryLeaf

java.lang.Object
  extended byBasicCloneable
      extended byorg.objectweb.medor.lib.BasicTupleStructure
          extended byorg.objectweb.medor.query.lib.MedorTCQueryLeaf
All Implemented Interfaces:
AnnotationsHolder, Cloneable, java.lang.Cloneable, QueryLeaf, QueryTree, java.io.Serializable, 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.

See Also:
Serialized Form

Field Summary
protected  java.util.Map annotations
           
protected  DataStore ds
           
protected  Expression filter
           
protected  TupleLoader loader
           
protected  java.lang.String nodeName
           
protected  TupleCollection tcData
           
 
Fields inherited from class org.objectweb.medor.lib.BasicTupleStructure
fields, logger, name2field
 
Constructor Summary
MedorTCQueryLeaf()
           
MedorTCQueryLeaf(java.lang.String nodeName, java.lang.String tcName, TupleCollection tcData)
           
 
Method Summary
 QueryTreeField addField(java.lang.String fieldName, PType type, Field tcField)
           
 java.lang.Object clone(java.lang.Object clone, java.util.Map obj2clone)
           
 java.util.Map getAnnotations()
           
 DataStore getDataStore()
           
 boolean getDistinct()
          Tests whether the results should be distinct or not.
 java.lang.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
contains, contains, getField, getField, getFieldRank, getFields, getSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.medor.api.Cloneable
clone
 

Field Detail

tcData

protected TupleCollection tcData

loader

protected TupleLoader loader

ds

protected DataStore ds

filter

protected Expression filter

nodeName

protected java.lang.String nodeName

annotations

protected java.util.Map annotations
Constructor Detail

MedorTCQueryLeaf

public MedorTCQueryLeaf()

MedorTCQueryLeaf

public MedorTCQueryLeaf(java.lang.String nodeName,
                        java.lang.String tcName,
                        TupleCollection tcData)
                 throws MedorException
Method Detail

addField

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

clone

public java.lang.Object clone(java.lang.Object clone,
                              java.util.Map obj2clone)
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class BasicTupleStructure
Throws:
java.lang.CloneNotSupportedException

getName

public java.lang.String getName()
Description copied from interface: QueryTree
It returns the name of the query tree.

Specified by:
getName in interface QueryTree

getTupleStructure

public TupleStructure getTupleStructure()
Description copied from interface: QueryTree
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
Description copied from interface: QueryTree
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:
d - is true if duplicates should be eliminated, false otherwise.
Throws:
MedorException - if the distinct operation is not supported.

getDistinct

public boolean getDistinct()
Description copied from interface: QueryTree
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.

setOrderBy

public void setOrderBy(OrderField[] orderfields)
                throws MedorException
Description copied from interface: QueryTree
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:
orderfields - the array of OrderFields indicating the ordering in which the result should be returned.
Throws:
MedorException - if ordering is not supported.

getOrderBy

public OrderField[] getOrderBy()
Description copied from interface: QueryTree
Returns the array of OrderFields indicating how the result should be ordered.

Specified by:
getOrderBy in interface QueryTree
Returns:
the array of OrderFields.

getDataStore

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

getTupleCollection

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

getTupleLoader

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

setTupleLoader

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

getQueryFilter

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

setQueryFilter

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

getAnnotations

public java.util.Map getAnnotations()
Specified by:
getAnnotations in interface AnnotationsHolder
Returns:
a map containing associations key <-> value defining the annotations.