org.objectweb.medor.query.lib

Class BasicQueryTree

Implemented Interfaces:
Cloneable, Cloneable, QueryTree, TupleStructure
Known Direct Subclasses:
BasicQueryNode, BasicRdbQueryLeaf

public abstract class BasicQueryTree
extends BasicTupleStructure
implements QueryTree

A BasicQueryNode is an implementation of QueryNode. It also implements QueryIndexGenerator and RWTupleStructure (it is its own TupleStructure).

Author:
Sebastien Chassande-Barrioz

Field Summary

protected boolean
distinct
protected int[]
indexes
Contains ranges of attribute to be projected from the tuple resulting of the concatenation of the tuples from the children QueryTrees.
protected String
name
protected OrderField[]
orderfields

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

fields, logger, name2field

Constructor Summary

BasicQueryTree()
BasicQueryTree(String _name)

Method Summary

Object
clone(Object clone, Map obj2clone)
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.
TupleStructure
getTupleStructure()
Returns the TupleStructure associated to the QueryTree.
void
setDistinct(boolean distinct)
Indicates whether evaluating the QueryTree should return unique results (duplicate elimination) or not.
void
setOrderBy(OrderField[] orderfields)
Sets the OrderBy array of OrderFields.

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

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

Field Details

distinct

protected boolean distinct


indexes

protected int[] indexes
Contains ranges of attribute to be projected from the tuple resulting of the concatenation of the tuples from the children QueryTrees.


name

protected String name


orderfields

protected OrderField[] orderfields

Constructor Details

BasicQueryTree

public BasicQueryTree()


BasicQueryTree

public BasicQueryTree(String _name)

Method Details

clone

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


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.


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 distinct)
            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:
distinct - is true if duplicates should be eliminated, false otherwise.

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


setOrderBy

public void setOrderBy(OrderField[] orderfields)
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: