public class ExprWHILE extends java.lang.Object implements Expression
Modifier and Type | Field and Description |
---|---|
protected CodeBlock |
block |
STRUCT_ARRAY, STRUCT_SCALAR, STRUCT_STRUCTURE, TYPE_BOOL, TYPE_DYNAMIC, TYPE_FLOAT, TYPE_INTEGER, TYPE_NUMERIC, TYPE_STRING, TYPE_UNDEF
Constructor and Description |
---|
ExprWHILE(Expression root) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
java.lang.Object |
eval()
Evaluate the expression.
|
boolean |
evalAsBoolean()
Evaluate the expression as a boolean.
|
float |
evalAsFloat()
Evaluate the expression as a float.
|
int |
evalAsInt()
Evaluate the expression as an int.
|
Expression |
getCondition() |
Expression |
getExpression()
Return the associated expression.
|
java.lang.String |
getExpressionName()
Return the expression name.
|
CodeBlock |
getParentBlock()
Return the parent expression block if the expression is one of several expressions separated by commas.
|
short |
getResultStructure()
Return the structure of the result for the expression.
|
short |
getResultType()
Return the type of the result for the expression.
|
Expression |
getRoot()
Return the root expression.
|
Variable |
getVariable(java.lang.String varName)
Return a variable declared by the expression.
|
java.util.Map<java.lang.String,Variable> |
getVariables()
Return the variables used by this expression.
|
void |
setBreak() |
void |
setCondition(Expression cond) |
void |
setExpression(Expression expr) |
void |
setParentBlock(CodeBlock block)
Set the parent expression block.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLocalVariable, getLocalVariables, getVariable, getVariables, hasVariable, hasVariable, removeVariable
protected CodeBlock block
public ExprWHILE(Expression root)
public Expression getRoot()
getRoot
in interface Expression
public 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 void setCondition(Expression cond)
public Expression getCondition()
public void setExpression(Expression expr)
public Expression getExpression()
Expression
getExpression
in interface Expression
public java.util.Map<java.lang.String,Variable> getVariables()
Expression
int c=a+b
, only "a" and "b" will be returned.getVariables
in interface Expression
public java.lang.String getExpressionName()
Expression
getExpressionName
in interface Expression
public short getResultType()
Expression
ExpressionType.TYPE_INTEGER
: integerExpressionType.TYPE_FLOAT
: floatExpressionType.TYPE_NUMERIC
: integer or float value. The runtime actual type may depend on the expression argumentsExpressionType.TYPE_STRING
: stringExpressionType.TYPE_DYNAMIC
: dynamic type. The runtime actual type may depend on the expression argumentsExpressionType.TYPE_UNDEF
: undefined type. The default type, characteristic of an error if entountered.getResultType
in interface Expression
public short getResultStructure()
Expression
ExpressionType.STRUCT_SCALAR
: a scalar valueExpressionType.STRUCT_ARRAY
: an array valuegetResultStructure
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
public java.lang.Object eval()
Expression
eval
in interface Expression
public Variable getVariable(java.lang.String varName)
Expression
getVariable
in interface Expression
varName
- the variable namepublic void setBreak()
Copyright © 2018 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence