org.simulator.sbml.astnode
Class ASTNodeObject

java.lang.Object
  extended by org.simulator.sbml.astnode.ASTNodeObject
Direct Known Subclasses:
CompartmentOrParameterValue, FunctionValue, LocalParameterValue, NamedValue, ReactionValue, RootFunctionValue, SpeciesReferenceValue, SpeciesValue

public class ASTNodeObject
extends java.lang.Object

This class can compute and store the interpreted value (double or boolean) of an ASTNode at the current time. A new computation is only done if the time has changed. So the computation is time-efficient.

Since:
1.0
Version:
$Rev: 22 $
Author:
Roland Keller

Field Summary
protected  boolean alreadyProcessed
          Flag that tells whether a calculation of the value has already been done (important in the case of constant values)
protected  boolean booleanValue
          Boolean value of the node (if the type of the value is boolean)
protected  java.util.List<ASTNodeObject> children
          The ASTNodeObjects of the child nodes of the corresponding ASTNode
protected  int denominator
          The denominator of the corresponding ASTNode
protected  double doubleValue
          Double value of the node (if the type of the value is double)
protected  int exponent
          The exponent of the corresponding ASTNode
protected  ASTNodeInterpreterWithTime interpreter
          The interpreter for calculating the value
protected  boolean isConstant
          Flag that is true if the value of the ASTNode is constant.
protected  boolean isDouble
          Flag that is true if the value has double as type and false if the value is boolean
protected  boolean isInfinite
          Flag that is true if the value is positive/negative infinity
protected  ASTNodeObject leftChild
          The ASTNodeObject of the left child of the corresponding ASTNode
static java.util.logging.Logger logger
          A logger
protected  double mantissa
          The mantissa of the corresponding ASTNode
protected  java.lang.String name
          The name of the corresponding ASTNode
protected  org.sbml.jsbml.ASTNode node
          The ASTNode this object is referring to
protected  org.sbml.jsbml.ASTNode.Type nodeType
          The node type of the corresponding ASTNode
protected  int numChildren
          The number of children of the corresponding ASTNode
protected  int numerator
          The numerator of the corresponding ASTNode
protected  double real
          The real value of the corresponding ASTNode
protected  ASTNodeObject rightChild
          The ASTNodeObject of the right child of the corresponding ASTNode
protected  double time
          The time of the last computation
protected  java.lang.String units
          The units of the corresponding ASTNode
 
Constructor Summary
ASTNodeObject(ASTNodeInterpreterWithTime interpreter, org.sbml.jsbml.ASTNode node)
           
 
Method Summary
 boolean compileBoolean(double time)
          Computes the boolean value if the time has changed and otherwise returns the already computed value
 double compileDouble(double time)
          Computes the double value if the time has changed and otherwise returns the already computed value
protected  void computeBooleanValue()
          Computes the boolean value of the node.
protected  void computeDoubleValue()
          Computes the double value of the node.
 boolean getConstant()
           
 java.lang.String getName()
          Returns the name of the corresponding ASTNode.
 double getTime()
           
 java.lang.Object getValue(double time)
          Returns the value as an object (double or boolean)
 boolean isName()
          Returns true if the corresponding ASTNode is of type name.
 void reset()
          Resets the node
 void setTime(double time)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

time

protected double time
The time of the last computation


isConstant

protected boolean isConstant
Flag that is true if the value of the ASTNode is constant.


isInfinite

protected boolean isInfinite
Flag that is true if the value is positive/negative infinity


booleanValue

protected boolean booleanValue
Boolean value of the node (if the type of the value is boolean)


doubleValue

protected double doubleValue
Double value of the node (if the type of the value is double)


isDouble

protected boolean isDouble
Flag that is true if the value has double as type and false if the value is boolean


node

protected org.sbml.jsbml.ASTNode node
The ASTNode this object is referring to


nodeType

protected org.sbml.jsbml.ASTNode.Type nodeType
The node type of the corresponding ASTNode


children

protected java.util.List<ASTNodeObject> children
The ASTNodeObjects of the child nodes of the corresponding ASTNode


leftChild

protected ASTNodeObject leftChild
The ASTNodeObject of the left child of the corresponding ASTNode


rightChild

protected ASTNodeObject rightChild
The ASTNodeObject of the right child of the corresponding ASTNode


name

protected java.lang.String name
The name of the corresponding ASTNode


numChildren

protected int numChildren
The number of children of the corresponding ASTNode


alreadyProcessed

protected boolean alreadyProcessed
Flag that tells whether a calculation of the value has already been done (important in the case of constant values)


interpreter

protected ASTNodeInterpreterWithTime interpreter
The interpreter for calculating the value


real

protected double real
The real value of the corresponding ASTNode


mantissa

protected double mantissa
The mantissa of the corresponding ASTNode


exponent

protected int exponent
The exponent of the corresponding ASTNode


numerator

protected int numerator
The numerator of the corresponding ASTNode


denominator

protected int denominator
The denominator of the corresponding ASTNode


units

protected java.lang.String units
The units of the corresponding ASTNode


logger

public static final java.util.logging.Logger logger
A logger

Constructor Detail

ASTNodeObject

public ASTNodeObject(ASTNodeInterpreterWithTime interpreter,
                     org.sbml.jsbml.ASTNode node)
Parameters:
interpreter -
node -
Method Detail

reset

public void reset()
Resets the node


getTime

public double getTime()
Returns:
the time of the last computation of the value

setTime

public void setTime(double time)
Parameters:
time -

getConstant

public boolean getConstant()
Returns:
constant value?

getValue

public java.lang.Object getValue(double time)
Returns the value as an object (double or boolean)

Parameters:
time -
Returns:

compileDouble

public double compileDouble(double time)
Computes the double value if the time has changed and otherwise returns the already computed value

Parameters:
time -
Returns:

compileBoolean

public boolean compileBoolean(double time)
Computes the boolean value if the time has changed and otherwise returns the already computed value

Parameters:
time -
Returns:

computeDoubleValue

protected void computeDoubleValue()
Computes the double value of the node.


computeBooleanValue

protected void computeBooleanValue()
Computes the boolean value of the node.


isName

public boolean isName()
Returns true if the corresponding ASTNode is of type name.

Returns:

getName

public java.lang.String getName()
Returns the name of the corresponding ASTNode.

Returns: