public abstract class AbstractExpression extends java.lang.Object implements Expression
eval()
methods which cefault to Expression.eval()
.Modifier and Type | Field and Description |
---|---|
protected CodeBlock |
block |
protected Expression |
root |
STRUCT_ARRAY, STRUCT_SCALAR, STRUCT_STRUCTURE, TYPE_BOOL, TYPE_DYNAMIC, TYPE_FLOAT, TYPE_INTEGER, TYPE_NUMERIC, TYPE_STRING, TYPE_UNDEF
Constructor and Description |
---|
AbstractExpression() |
AbstractExpression(Expression root) |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Object |
clone() |
boolean |
evalAsBoolean()
Evaluate the expression as a boolean.
|
float |
evalAsFloat()
Evaluate the expression as a float.
|
int |
evalAsInt()
Evaluate the expression as an int.
|
CodeBlock |
getParentBlock()
Return the parent expression block if the expression is one of several expressions separated by commas.
|
Expression |
getRoot()
Return the root expression.
|
void |
setParentBlock(CodeBlock block)
Set the parent expression block.
|
void |
setRoot(Expression root)
Set the root expression.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
eval, getExpression, getExpressionName, getLocalVariable, getLocalVariables, getResultStructure, getResultType, getVariable, getVariable, getVariables, getVariables, hasVariable, hasVariable, removeVariable
protected CodeBlock block
protected Expression root
public AbstractExpression()
public AbstractExpression(Expression root)
public void setRoot(Expression root)
root
- the root expressionpublic abstract java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface Expression
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public void setParentBlock(CodeBlock block)
Expression
setParentBlock
in interface Expression
block
- the parent expression blockpublic CodeBlock getParentBlock()
Expression
b=a+2; return b
, the two "b=a+2" and "return b" have "b=a+2; return b" as their
parent block.getParentBlock
in interface Expression
public Expression getRoot()
getRoot
in interface Expression
public int evalAsInt()
Expression
Expression.eval()
, but the evaluation
engine will be able to optimize the computation by knwoing that the result is an int (primitive valeus are cached internally).evalAsInt
in interface Expression
public float evalAsFloat()
Expression
Expression.eval()
, but the evaluation
engine will be able to optimize the computation by knwoing that the result is a float (primitive valeus are cached internally).evalAsFloat
in interface Expression
public boolean evalAsBoolean()
Expression
Expression.eval()
, but the evaluation
engine will be able to optimize the computation by knwoing that the result is a boolean (primitive valeus are cached internally).evalAsBoolean
in interface Expression
Copyright © 2018 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence