org.objectweb.medor.filter.lib
Class BasicBinaryOperator

java.lang.Object
  |
  +--org.objectweb.medor.filter.lib.BasicBinaryOperator
All Implemented Interfaces:
BinaryOperator, Cloneable, java.lang.Cloneable, Expression, Operator
Direct Known Subclasses:
BasicBelongOperator, BasicBinaryArithmeticOperator, BasicBinaryLogicalOperator, BasicComparator, Concat, FirstLocate, InCollection, NavigatorOperator, SinglePName

public abstract class BasicBinaryOperator
extends java.lang.Object
implements BinaryOperator

Author:
Sebastien Chassande-Barrioz

Field Summary
protected  Expression left
           
protected  Operand leftResult
           
protected  VariableOperand result
           
protected  Expression right
           
protected  Operand rightResult
           
protected  PType type
           
protected  boolean verified
           
 
Fields inherited from interface org.objectweb.medor.filter.api.Operator
ABS, AND, BITWIZE, CONCAT, CONDAND, CONDOR, DIV, EQUAL, FIRSTLOCATE, GREATER, GREATEREQUAL, IN, INDEXEDLOCATE, LENGTH, LOWER, LOWEREQUAL, MEMBEROF, MINUS, MULT, NAV, NOT, NOTEQUAL, NOTMEMBEROF, OR, PLUS, SQRT, SUBSTRING, UMINUS
 
Constructor Summary
BasicBinaryOperator()
           
 
Method Summary
 java.lang.Object clone()
           
abstract  void evaluate(ParameterOperand[] pos, Tuple t)
          It evaluates the expression tree and puts the result into the operand result.
 Expression getExpression(int idx)
           
 Expression getLeftExpression()
           
 int getOperandNumber()
           
 Operand getResult()
          Gets the operand in wich the result will be put in
 Expression getRightExpression()
           
 PType getType()
          It gets the result type of this expression
 boolean isCompiled()
          Gets wether this expression is compiled or not
 void setExpression(int idx, Expression exp)
           
 void setLeftExpression(Expression leftChild)
          This method sets the left operand or operator to this expression object.
 void setRightExpression(Expression rightChild)
          This method sets the left operand or operator to this expression object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.medor.filter.api.Operator
getOperatorString
 
Methods inherited from interface org.objectweb.medor.filter.api.Expression
compileExpression
 

Field Detail

type

protected PType type

left

protected Expression left

right

protected Expression right

result

protected VariableOperand result

leftResult

protected Operand leftResult

rightResult

protected Operand rightResult

verified

protected boolean verified
Constructor Detail

BasicBinaryOperator

public BasicBinaryOperator()
Method Detail

getOperandNumber

public int getOperandNumber()
Specified by:
getOperandNumber in interface Operator

getExpression

public Expression getExpression(int idx)
                         throws java.lang.ArrayIndexOutOfBoundsException
Specified by:
getExpression in interface Operator
java.lang.ArrayIndexOutOfBoundsException

setExpression

public void setExpression(int idx,
                          Expression exp)
                   throws java.lang.ArrayIndexOutOfBoundsException
Specified by:
setExpression in interface Operator
java.lang.ArrayIndexOutOfBoundsException

getType

public PType getType()
Description copied from interface: Expression
It gets the result type of this expression

Specified by:
getType in interface Expression
Returns:
a PType object

evaluate

public abstract void evaluate(ParameterOperand[] pos,
                              Tuple t)
                       throws MedorException
Description copied from interface: Expression
It evaluates the expression tree and puts the result into the operand result.

Specified by:
evaluate in interface Expression
Parameters:
pos - a list of ParameterOperand
t - Tuple
Throws:
MedorException - if evaluation error

setLeftExpression

public void setLeftExpression(Expression leftChild)
                       throws java.lang.IllegalStateException
Description copied from interface: BinaryOperator
This method sets the left operand or operator to this expression object. There is no verification of types when performing this method. After evaluating, we must compile this expression.

Specified by:
setLeftExpression in interface BinaryOperator
java.lang.IllegalStateException

setRightExpression

public void setRightExpression(Expression rightChild)
                        throws java.lang.IllegalStateException
Description copied from interface: BinaryOperator
This method sets the left operand or operator to this expression object. There is no verification of types when performing this method. After evaluating, we must compile this expression.

Specified by:
setRightExpression in interface BinaryOperator
java.lang.IllegalStateException

getLeftExpression

public Expression getLeftExpression()
Specified by:
getLeftExpression in interface BinaryOperator

getRightExpression

public Expression getRightExpression()
Specified by:
getRightExpression in interface BinaryOperator

isCompiled

public boolean isCompiled()
Description copied from interface: Expression
Gets wether this expression is compiled or not

Specified by:
isCompiled in interface Expression
Returns:
true if the expression is compiled and false if it is not

getResult

public Operand getResult()
                  throws java.lang.IllegalStateException
Description copied from interface: Expression
Gets the operand in wich the result will be put in

Specified by:
getResult in interface Expression
Returns:
an Operand Object
Throws:
java.lang.IllegalStateException - if this expression is not compiled.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Cloneable
Overrides:
clone in class java.lang.Object
java.lang.CloneNotSupportedException