org.objectweb.medor.filter.jorm.lib

Class NavigatorOperator


public class NavigatorOperator
extends BasicBinaryOperator

A NavigatorOperator typically represents a path expression.

Such an expression starts from a FieldOperand for which the origin field is a JormField of a PName type (ref).

Field Summary

protected boolean
isPName

Constructor Summary

NavigatorOperator(FieldOperand fop, String att)
Creates a NavigatorOperator from a FieldOperand and an attribute name.
NavigatorOperator(NavigatorOperator nop, String att)
Creates a NavigatorOperator from a previously existing NavigatorOperator and an attribute name.

Method Summary

Object
clone(Object clone, Map obj2clone)
Operand
compileExpression()
Checks the semantic integrity of an expression.
Operand
evaluate(ParameterOperand[] pos, Object o)
This operator is not evaluable, and must be transformed into JoinProject instances during the optimization step.
FieldOperand
getFieldOperand()
Obtains the FieldOperand at the start of the navigation.
MetaObject
getMetaObject()
Returns the Jorm Meta object which describes the field that is reached by this navigator.
String
getOperatorString()
Returns the String representing the operator in Java
ArrayList
getPath()
Constructs an ArrayList containing the elements of the corresponding path expression, excluding the initial FieldOperand.
ArrayList
getPath(ArrayList theList)
Starting from an input ArrayList, adds the elements of the corresponding path expression, excluding the initial FieldOperand.
boolean
isPName()
Returns 'true' if the current path designes a field which is a reference.

Field Details

isPName

protected boolean isPName

Constructor Details

NavigatorOperator

public NavigatorOperator(FieldOperand fop,
                         String att)
            throws MedorException
Creates a NavigatorOperator from a FieldOperand and an attribute name. The origin field of this FieldOperand must be a JormField of a PName type (or a PropagatedField pointing to such a JormField).

Parameters:
fop - is the FieldOperand corresponding to the left operand.
att - is the name of the attribute to which the operator nagivates.

Throws:
MedorException - when fop does not reference a PNameField or when no field att is reachable by the PNameField.


NavigatorOperator

public NavigatorOperator(NavigatorOperator nop,
                         String att)
            throws MedorException
Creates a NavigatorOperator from a previously existing NavigatorOperator and an attribute name.

Parameters:
nop - is the NavigatorOperator corresponding to the left operand.
att - is the name of the attribute to which the operator nagivates.

Throws:
MedorException - when nop does not match a PName or when no field att is reachable by the PName.

Method Details

clone

public Object clone(Object clone,
                    Map obj2clone)
            throws CloneNotSupportedException


compileExpression

public Operand compileExpression()
            throws MalformedExpressionException
Checks the semantic integrity of an expression.

It checks that all types are compatible and prepare the expression to be evaluable.It also creates buffers where stores the result. Notes that when evaluating there is no creation of new objects. This method change the state of this expression object, it will be evaluable and not modifiable.


evaluate

public Operand evaluate(ParameterOperand[] pos,
                        Object o)
            throws ExpressionException
This operator is not evaluable, and must be transformed into JoinProject instances during the optimization step.


getFieldOperand

public FieldOperand getFieldOperand()
Obtains the FieldOperand at the start of the navigation.

Returns:
the FieldOperand corresponding to the start of the navigation.


getMetaObject

public MetaObject getMetaObject()
Returns the Jorm Meta object which describes the field that is reached by this navigator. The jorm field is never null.


getOperatorString

public String getOperatorString()
Returns the String representing the operator in Java

Returns:
the String representing the operator in Java


getPath

public ArrayList getPath()
            throws MedorException
Constructs an ArrayList containing the elements of the corresponding path expression, excluding the initial FieldOperand.

Returns:
the path expression (excluding the initial FieldOperand), as an arrayList.

Throws:
MedorException -


getPath

public ArrayList getPath(ArrayList theList)
            throws MedorException
Starting from an input ArrayList, adds the elements of the corresponding path expression, excluding the initial FieldOperand.

Parameters:
theList - is the initial ArrayList into which to add the path elements

Returns:
the modified ArrayList containing the added path elements

Throws:
MedorException -


isPName

public boolean isPName()
Returns 'true' if the current path designes a field which is a reference. It returns 'false' if the current path designes a primitive field.