public abstract class AbstractValue extends AbstractExpression implements Value
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name |
protected short |
struct |
protected short |
type |
protected ValueWrapper |
value |
block, root
STRUCT_ARRAY, STRUCT_SCALAR, STRUCT_STRUCTURE, TYPE_BOOL, TYPE_DYNAMIC, TYPE_FLOAT, TYPE_INTEGER, TYPE_NUMERIC, TYPE_STRING, TYPE_UNDEF
Constructor and Description |
---|
AbstractValue() |
AbstractValue(Expression root) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkType() |
boolean |
equals(java.lang.Object o) |
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 |
getExpression()
Return the equation associated expression.
|
java.lang.String |
getName() |
short |
getStructure()
Return the value structure.
|
short |
getType()
Return the value type.
|
java.lang.Object |
getValue()
Return the value.
|
boolean |
getValueAsBoolean()
Return the value as a boolean.
|
float |
getValueAsFloat()
Return the value as a float.
|
int |
getValueAsInt()
Return the value as an int.
|
int |
hashCode() |
protected void |
initType() |
protected void |
setDefaultValue()
Set the default value for the type.
|
void |
setName(java.lang.String name) |
void |
setStructure(short struct)
Set the structure of the value.
|
void |
setType(short type)
Set the type of the value.
|
void |
setType(short type,
short struct)
Set the type and structure of the value.
|
void |
setValue(java.lang.Object value) |
void |
setValueAsBoolean(boolean value) |
void |
setValueAsFloat(float value) |
void |
setValueAsInt(int value) |
clone, getParentBlock, getRoot, setParentBlock, setRoot
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
clone, getExpressionName, getLocalVariable, getLocalVariables, getParentBlock, getResultStructure, getResultType, getRoot, getVariable, getVariable, getVariables, getVariables, hasVariable, hasVariable, removeVariable, setParentBlock
protected short type
protected short struct
protected ValueWrapper value
protected java.lang.String name
public AbstractValue()
public AbstractValue(Expression root)
public void setName(java.lang.String name)
public final void setType(short type, short struct)
public final void setType(short type)
public final void setStructure(short struct)
setStructure
in interface Value
struct
- the structureprotected void setDefaultValue()
protected void initType()
protected void checkType()
public Expression getExpression()
Equation
getExpression
in interface Equation
getExpression
in interface Expression
public java.lang.Object getValue()
Value
public int getValueAsInt()
Value
getValueAsInt
in interface Value
public float getValueAsFloat()
Value
getValueAsFloat
in interface Value
public boolean getValueAsBoolean()
Value
getValueAsBoolean
in interface Value
public void setValueAsInt(int value)
setValueAsInt
in interface Value
public void setValueAsFloat(float value)
setValueAsFloat
in interface Value
public void setValueAsBoolean(boolean value)
setValueAsBoolean
in interface Value
public final 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
evalAsInt
in class AbstractExpression
public final 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
evalAsFloat
in class AbstractExpression
public final 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
evalAsBoolean
in class AbstractExpression
public java.lang.Object eval() throws java.lang.ArithmeticException
Expression
eval
in interface Expression
java.lang.ArithmeticException
public short getType()
public short getStructure()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2018 Herve Girod. All Rights Reserved. Documentation and source under the BSD licence