org.objectweb.medor.query.lib

Class BasicQueryNode

Implemented Interfaces:
Cloneable, Cloneable, FilteredQueryTree, QueryNode, QueryTree, TupleStructure
Known Direct Subclasses:
Cartesian, Intersection, JoinProject, Nest, Project, SelectProject, Union, Unnest

public abstract class BasicQueryNode
extends BasicQueryTree
implements QueryNode

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 ArrayList
children
protected Expression
filter
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 HashSet
inner
protected TupleLoader
tupleLoader

Fields inherited from class org.objectweb.medor.query.lib.BasicQueryTree

distinct, indexes, name, orderfields

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

fields, logger, name2field

Constructor Summary

BasicQueryNode()
BasicQueryNode(String name)

Method Summary

CalculatedField
addCalculatedField(String name, PType type, Expression exp)
Creates and adds a CalculatedField to the TupleStructure of the QueryNode.
protected void
addChild(QueryTree qt)
protected void
addField(Field f)
Adds a Field to the current RWTupleStructure
PropagatedField
addPropagatedField(String name, PType type, QueryTreeField[] anc)
Creates and adds a PropagatedField to the TupleStructure of the QueryNode.
Object
clone(Object clone, Map obj2clone)
QueryTree[]
getChildren()
protected String
getFieldName(String nodeName, String fieldName)
Expression
getQueryFilter()
Retrieves the filter associated to the QueryTree.
TupleLoader
getTupleLoader()
short
getType()
boolean
isOuter(QueryTree child)
QueryTreeField
removeField(String name)
Removes a Field.
QueryTreeField
replace(QueryTreeField old, QueryTreeField neo)
void
setOuter(QueryTree child, boolean value)
void
setQueryFilter(Expression filter)
The setQueryFilter method will be overwritten for implementations which do not support the operation.
void
setTupleLoader(TupleLoader loader)
void
updateCalculatedField(String name, Expression e)
protected void
updateChildren()
Updates the list of children by screening all Fields and the query filter.
void
updatePropagatedField(String name, QueryTreeField[] previous)

Methods inherited from class org.objectweb.medor.query.lib.BasicQueryTree

clone, getDistinct, getName, getOrderBy, getTupleStructure, setDistinct, setOrderBy

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

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

Field Details

children

protected ArrayList children


filter

protected Expression filter


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.


inner

protected HashSet inner


tupleLoader

protected TupleLoader tupleLoader

Constructor Details

BasicQueryNode

public BasicQueryNode()


BasicQueryNode

public BasicQueryNode(String name)

Method Details

addCalculatedField

public CalculatedField addCalculatedField(String name,
                                          PType type,
                                          Expression exp)
            throws MedorException
Creates and adds a CalculatedField to the TupleStructure of the QueryNode.
Specified by:
addCalculatedField in interface QueryNode

Parameters:
name - is the name of the Field to be added.
type - is the PType of the Field to be added.
exp - is the Expression for calculating the new Field.

Returns:
the newly created CalculatedField

Throws:
MedorException - when a Field with the same name already exists.


addChild

protected void addChild(QueryTree qt)


addField

protected void addField(Field f)
Adds a Field to the current RWTupleStructure

Parameters:
f - The Field to be added.


addPropagatedField

public PropagatedField addPropagatedField(String name,
                                          PType type,
                                          QueryTreeField[] anc)
            throws MedorException
Creates and adds a PropagatedField to the TupleStructure of the QueryNode.

Parameters:
name - is the name of the Field to be added.
type - is the PType of the Field to be added.
anc - are the origin Fields for the PropagatedField to be created.

Returns:
the newly created PropagatedField

Throws:
MedorException - when a Field with the same name already exists.


clone

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


getChildren

public QueryTree[] getChildren()
Specified by:
getChildren in interface QueryNode


getFieldName

protected String getFieldName(String nodeName,
                              String fieldName)


getQueryFilter

public Expression getQueryFilter()
Retrieves the filter associated to the QueryTree. This filter is represented by an Expression.
Specified by:
getQueryFilter in interface FilteredQueryTree

Returns:
the query filter Expression associated to the QueryNode.

See Also:
Expression


getTupleLoader

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


getType

public short getType()
Specified by:
getType in interface QueryNode


isOuter

public boolean isOuter(QueryTree child)
Specified by:
isOuter in interface QueryNode


removeField

public QueryTreeField removeField(String name)
            throws MedorException
Removes a Field.
Specified by:
removeField in interface QueryNode

Parameters:
name - is the name of the Field to be removed.

Returns:
the Field which has been removed, or null if no such Field could be removed.


replace

public QueryTreeField replace(QueryTreeField old,
                              QueryTreeField neo)
Specified by:
replace in interface QueryNode


setOuter

public void setOuter(QueryTree child,
                     boolean value)
Specified by:
setOuter in interface QueryNode


setQueryFilter

public void setQueryFilter(Expression filter)
            throws UnsupportedOperationException
The setQueryFilter method will be overwritten for implementations which do not support the operation.
Specified by:
setQueryFilter in interface FilteredQueryTree


setTupleLoader

public void setTupleLoader(TupleLoader loader)
Specified by:
setTupleLoader in interface QueryNode


updateCalculatedField

public void updateCalculatedField(String name,
                                  Expression e)
            throws MedorException
Specified by:
updateCalculatedField in interface QueryNode


updateChildren

protected void updateChildren()
Updates the list of children by screening all Fields and the query filter.


updatePropagatedField

public void updatePropagatedField(String name,
                                  QueryTreeField[] previous)
            throws MedorException