|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface represents an arithmetic and/or a boolean expression.
It represents operations over operands. It is represented by a tree where nodes represents operations and leafs operands. An expression have two states:
Not compiled in wich case it can be modified.
Compiled, this state is possible after compilation method CompileExpression().
Then it will be evaluable and its structure cannot be further modified.
Here is a simple example:
Expression exp = ...
exp.CompileExpression();
Operand op = exp.getResult();
exp.evaluate(......);
System.out.println("the result = "+ op.getInt());
Method Summary | |
Operand |
compileExpression()
Checks the semantic integrity of an expression. |
Operand |
evaluate(ParameterOperand[] values,
java.lang.Object o)
It evaluates the expression tree and puts the result into the operand result. |
org.objectweb.jorm.type.api.PType |
getType()
It gets the result type of this expression |
Methods inherited from interface org.objectweb.medor.clone.api.Cloneable |
clone |
Method Detail |
public org.objectweb.jorm.type.api.PType getType()
public Operand evaluate(ParameterOperand[] values, java.lang.Object o) throws ExpressionException
values
- a list of ParameterOperando
- the input Object from which values are taken for the
evaluation
java.lang.IllegalStateException
- if this expression is not
compiled.
ExpressionException
public Operand compileExpression() throws ExpressionException, MalformedExpressionException
TypingException
- when incompatible types error
occures.
MalformedExpressionException
- if syntax error
ExpressionException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |