T - public class ASTNode2Value<T>
extends java.lang.Object
ASTNode2s, the ASTNode2Compiler 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 ASTNode2Compiler which operation was performed to obtain the
value stored in this object.| Constructor and Description |
|---|
ASTNode2Value(ASTNode2Compiler compiler) |
ASTNode2Value(T value,
ASTNode2Compiler compiler) |
ASTNode2Value(UnitDefinition unit,
ASTNode2Compiler 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
ASTNode2Value. |
ASTNode.Type |
getType() |
UnitDefinition |
getUnits() |
T |
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(T 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 ASTNode2Value(ASTNode2Compiler compiler)
compiler - public ASTNode2Value(T value, ASTNode2Compiler compiler)
value - compiler - public ASTNode2Value(UnitDefinition unit, ASTNode2Compiler compiler)
unit - compiler - public boolean containsUndeclaredUnits()
public int getLevel()
ASTNode2Value.public ASTNode.Type getType()
public UnitDefinition getUnits()
public T 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(T 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
ASTNode2Compiler associated with this object compiles this
value to an ASTNode2Value 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()