org.objectweb.medor.expression.lib

Class BasicBinaryArithmeticOperator

Implemented Interfaces:
BinaryArithmeticOperator, BinaryOperator, org.objectweb.medor.clone.api.Cloneable, Expression, Operator, Serializable
Known Direct Subclasses:
DivideBy, Minus, Mod, Mult, Plus

public abstract class BasicBinaryArithmeticOperator
extends BasicBinaryOperator
implements BinaryArithmeticOperator

Author:
Sebastien Chassande-Barrioz

Field Summary

Fields inherited from class org.objectweb.medor.expression.lib.BasicOperator

expressions, result, verified

Fields inherited from class org.objectweb.medor.expression.lib.BasicExpression

logger, type

Fields inherited from interface org.objectweb.medor.expression.api.Operator

ABS, AND, AVG, BITWIZE, CONCAT, CONDAND, CONDOR, COUNT, DIV, EQUAL, FIRSTLOCATE, GREATER, GREATEREQUAL, IN, INDEXEDLOCATE, LENGTH, LOWER, LOWEREQUAL, MAX, MEMBEROF, MIN, MINUS, MOD, MULT, NAV, NOT, NOTEQUAL, NOTMEMBEROF, OR, PLUS, SQRT, STRING_LOWER, STRING_UPPER, SUBSTRING, SUM, UMINUS

Constructor Summary

BasicBinaryArithmeticOperator()
BasicBinaryArithmeticOperator(PType type)
BasicBinaryArithmeticOperator(PType type, Expression e0, Expression e1)
BasicBinaryArithmeticOperator(Expression e0, Expression e1)

Method Summary

Operand
compileExpression()
Checks the semantic integrity of an expression.
BigDecimal
evaluate(BigDecimal op1, BigDecimal op2)
BigInteger
evaluate(BigInteger op1, BigInteger op2)
Date
evaluate(Date op1, Date op2)
String
evaluate(String op1, String op2)
String
evaluate(String op1, char op2)
String
evaluate(char op1, String op2)
int
evaluate(char op1, char op2)
double
evaluate(double op1, double op2)
double
evaluate(double op1, float op2)
double
evaluate(double op1, int op2)
double
evaluate(double op1, long op2)
double
evaluate(double op1, short op2)
double
evaluate(float op1, double op2)
float
evaluate(float op1, float op2)
float
evaluate(float op1, int op2)
float
evaluate(float op1, long op2)
float
evaluate(float op1, short op2)
double
evaluate(int op1, double op2)
float
evaluate(int op1, float op2)
int
evaluate(int op1, int op2)
long
evaluate(int op1, long op2)
int
evaluate(int op1, short op2)
double
evaluate(long op1, double op2)
float
evaluate(long op1, float op2)
long
evaluate(long op1, int op2)
long
evaluate(long op1, long op2)
long
evaluate(long op1, short op2)
Operand
evaluate(ParameterOperand[] pos, Object o)

Methods inherited from class org.objectweb.medor.expression.lib.BasicBinaryOperator

getLeftExpression, getRightExpression, setLeftExpression, setRightExpression

Methods inherited from class org.objectweb.medor.expression.lib.BasicOperator

clone, getExpression, getOperandNumber, setExpression

Methods inherited from class org.objectweb.medor.expression.lib.BasicExpression

clone, getType

Methods inherited from class org.objectweb.medor.clone.lib.BasicCloneable

clone, clone, clone, getClone

Constructor Details

BasicBinaryArithmeticOperator

public BasicBinaryArithmeticOperator()


BasicBinaryArithmeticOperator

public BasicBinaryArithmeticOperator(PType type)


BasicBinaryArithmeticOperator

public BasicBinaryArithmeticOperator(PType type,
                                     Expression e0,
                                     Expression e1)


BasicBinaryArithmeticOperator

public BasicBinaryArithmeticOperator(Expression e0,
                                     Expression e1)

Method Details

compileExpression

public Operand compileExpression()
            throws ExpressionException,
                   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.
Specified by:
compileExpression in interface Expression

Throws:
MalformedExpressionException - if syntax error


evaluate

public BigDecimal evaluate(BigDecimal op1,
                           BigDecimal op2)


evaluate

public BigInteger evaluate(BigInteger op1,
                           BigInteger op2)


evaluate

public Date evaluate(Date op1,
                     Date op2)
            throws TypingException
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public String evaluate(String op1,
                       String op2)
            throws TypingException
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public String evaluate(String op1,
                       char op2)
            throws TypingException
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public String evaluate(char op1,
                       String op2)
            throws TypingException
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public int evaluate(char op1,
                    char op2)
            throws TypingException
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public double evaluate(double op1,
                       double op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public double evaluate(double op1,
                       float op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public double evaluate(double op1,
                       int op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public double evaluate(double op1,
                       long op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public double evaluate(double op1,
                       short op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public double evaluate(float op1,
                       double op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public float evaluate(float op1,
                      float op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public float evaluate(float op1,
                      int op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public float evaluate(float op1,
                      long op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public float evaluate(float op1,
                      short op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public double evaluate(int op1,
                       double op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public float evaluate(int op1,
                      float op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public int evaluate(int op1,
                    int op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public long evaluate(int op1,
                     long op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public int evaluate(int op1,
                    short op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public double evaluate(long op1,
                       double op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public float evaluate(long op1,
                      float op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public long evaluate(long op1,
                     int op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public long evaluate(long op1,
                     long op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public long evaluate(long op1,
                     short op2)
Specified by:
evaluate in interface BinaryArithmeticOperator


evaluate

public Operand evaluate(ParameterOperand[] pos,
                        Object o)
            throws ExpressionException