public class ASTNodeValue
extends java.lang.Object
ASTNodes, the ASTNodeCompiler takes
elements of this class as arguments and performs its operations on it. Hence,
this class represents the union of all possible types to which an abstract
syntax tree can be evaluated, i.e., Boolean,
CallableSBase, Number, or String. This
class does not define what to do with these values or how to perform any
operations on it. It is just the container of a value. The type of this value
tells the ASTNodeCompiler which operation was performed to obtain the
value stored in this object.| Constructor and Description |
|---|
ASTNodeValue(ASTNodeCompiler compiler) |
ASTNodeValue(boolean value,
ASTNodeCompiler compiler) |
ASTNodeValue(CallableSBase value,
ASTNodeCompiler compiler) |
ASTNodeValue(double value,
ASTNodeCompiler compiler) |
ASTNodeValue(float value,
ASTNodeCompiler compiler) |
ASTNodeValue(int value,
ASTNodeCompiler compiler) |
ASTNodeValue(long value,
ASTNodeCompiler compiler) |
ASTNodeValue(org.w3c.dom.Node node,
ASTNodeCompiler compiler) |
ASTNodeValue(java.lang.Number value,
ASTNodeCompiler compiler) |
ASTNodeValue(java.lang.String value,
ASTNodeCompiler compiler) |
ASTNodeValue(UnitDefinition unit,
ASTNodeCompiler compiler) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsUndeclaredUnits()
Flag to indicate whether or not units have been fully declared for this
value.
|
int |
getLevel()
Returns the level of the SBML document that was the basis to create this
ASTNodeValue. |
ASTNode.Type |
getType() |
UnitDefinition |
getUnits() |
java.lang.Object |
getValue() |
int |
getVersion() |
boolean |
isBoolean() |
boolean |
isCallableSBase() |
boolean |
isDifference() |
boolean |
isNode()
Checks whether the value encapsulated in this
ASTNodeValue is an
instance of Node. |
boolean |
isNumber() |
boolean |
isSetUnit()
Test if this value can be evaluated to a
UnitDefinition |
boolean |
isString() |
boolean |
isSum() |
boolean |
isUMinus() |
boolean |
isUnary() |
java.lang.String |
printValueAndUnit() |
void |
setLevel(int level) |
void |
setType(ASTNode.Type type) |
void |
setUIFlag(boolean uiFlag) |
void |
setUnits(UnitDefinition unit) |
void |
setValue(boolean value) |
void |
setValue(java.lang.Boolean value) |
void |
setValue(CallableSBase value) |
void |
setValue(double d) |
void |
setValue(int i) |
void |
setValue(long l) |
void |
setValue(org.w3c.dom.Node value) |
void |
setValue(java.lang.Number value) |
void |
setValue(short s) |
void |
setValue(java.lang.String value) |
void |
setVersion(int version) |
boolean |
toBoolean()
Analog to the toDouble() method but this method tries to evaluate the
value contained in this object to a boolean value.
|
CallableSBase |
toCallableSBase() |
double |
toDouble() |
float |
toFloat() |
int |
toInteger()
This method is analog to the toDouble method but tries to convert this
value into an integer.
|
long |
toLong() |
org.w3c.dom.Node |
toNode() |
java.lang.Number |
toNumber()
Tries to convert the value contained in this object into a double number.
|
java.lang.String |
toString() |
void |
unsetUnit()
Removes the unit of this element, i.e., the unit will become invalid.
|
public ASTNodeValue(ASTNodeCompiler compiler)
compiler - public ASTNodeValue(boolean value,
ASTNodeCompiler compiler)
value - compiler - public ASTNodeValue(double value,
ASTNodeCompiler compiler)
value - compiler - public ASTNodeValue(float value,
ASTNodeCompiler compiler)
value - compiler - public ASTNodeValue(long value,
ASTNodeCompiler compiler)
value - compiler - public ASTNodeValue(int value,
ASTNodeCompiler compiler)
value - compiler - public ASTNodeValue(CallableSBase value, ASTNodeCompiler compiler)
value - compiler - public ASTNodeValue(org.w3c.dom.Node node,
ASTNodeCompiler compiler)
node - compiler - public ASTNodeValue(java.lang.Number value,
ASTNodeCompiler compiler)
value - compiler - public ASTNodeValue(java.lang.String value,
ASTNodeCompiler compiler)
value - compiler - public ASTNodeValue(UnitDefinition unit, ASTNodeCompiler compiler)
unit - compiler - public boolean containsUndeclaredUnits()
public int getLevel()
ASTNodeValue.public ASTNode.Type getType()
public UnitDefinition getUnits()
public java.lang.Object getValue()
public int getVersion()
public boolean isBoolean()
public boolean isDifference()
public boolean isCallableSBase()
public boolean isNode()
ASTNodeValue is an
instance of Node.public boolean isNumber()
public boolean isSetUnit()
UnitDefinitionpublic boolean isString()
public boolean isSum()
public boolean isUMinus()
public boolean isUnary()
public java.lang.String printValueAndUnit()
public void setLevel(int level)
level - the level to setpublic void setType(ASTNode.Type type)
type - public void setUIFlag(boolean uiFlag)
uiFlag - public void setUnits(UnitDefinition unit)
unit - public void setValue(boolean value)
value - public void setValue(java.lang.Boolean value)
value - public void setValue(double d)
d - public void setValue(int i)
i - public void setValue(long l)
l - public void setValue(CallableSBase value)
value - public void setValue(org.w3c.dom.Node value)
value - public void setValue(java.lang.Number value)
value - public void setValue(short s)
s - public void setValue(java.lang.String value)
value - public void setVersion(int version)
version - the version to setpublic boolean toBoolean()
throws SBMLException
CallableSBase, it
can only be converted into a boolean value if the
ASTNodeCompiler associated with this object compiles this
value to an ASTNodeValue that contains a boolean or at
least a Number value.SBMLExceptionpublic double toDouble()
throws SBMLException
SBMLExceptionpublic float toFloat()
throws SBMLException
SBMLExceptionpublic int toInteger()
throws SBMLException
SBMLExceptionpublic long toLong()
throws SBMLException
SBMLExceptionpublic CallableSBase toCallableSBase()
public org.w3c.dom.Node toNode()
public java.lang.Number toNumber()
throws SBMLException
ASTNodeValue.
In case this ASTNodeValue contains an instance of
Boolean, zero is returned for false and one for true. If
the value is null or cannot be converted to any number,
Double.NaN will be returned. Note that if the value of
this container is an instance of
CallableSBase, the value can only be
converted to a number if the compiler associated with this
ASTNodeValue compiles this
CallableSBase to an ASTNodeValue that
contains a Number.SBMLExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void unsetUnit()