org.simulator.sbml.astnode
Class ASTNodeValue

java.lang.Object
  extended by org.simulator.sbml.astnode.ASTNodeValue
Direct Known Subclasses:
CompartmentOrParameterValue, DivideValue, FunctionValue, IntegerValue, LocalParameterValue, MinusValue, NamedValue, PlusValue, PowerValue, ReactionValue, RootFunctionValue, SpeciesReferenceValue, SpeciesValue, TimesValue

public class ASTNodeValue
extends 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: 205 $
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  ASTNodeValue[] 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  ASTNodeInterpreter 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  ASTNodeValue leftChild
          The ASTNodeObject of the left child of the corresponding ASTNode
static Logger logger
          A Logger for this class.
protected  double mantissa
          The mantissa of the corresponding ASTNode
protected  String name
          The name of the corresponding ASTNode
protected  ASTNode node
          The ASTNode this object is referring to
protected  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  ASTNodeValue rightChild
          The ASTNodeObject of the right child of the corresponding ASTNode
protected  double time
          The time of the last computation
protected  String units
          The units of the corresponding ASTNode
 
Constructor Summary
ASTNodeValue(ASTNodeInterpreter interpreter, 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, double delay)
          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(double delay)
          Computes the double value of the node.
 boolean getConstant()
           
 String getName()
          Returns the name of the corresponding ASTNode.
 ASTNode getNode()
           
 double getTime()
           
 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 ASTNode node
The ASTNode this object is referring to


nodeType

protected ASTNode.Type nodeType
The node type of the corresponding ASTNode


children

protected ASTNodeValue[] children
The ASTNodeObjects of the child nodes of the corresponding ASTNode


leftChild

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


rightChild

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


name

protected 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 ASTNodeInterpreter 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 String units
The units of the corresponding ASTNode


logger

public static final Logger logger
A Logger for this class.

Constructor Detail

ASTNodeValue

public ASTNodeValue(ASTNodeInterpreter interpreter,
                    ASTNode node)
Parameters:
interpreter -
node -
Method Detail

reset

public void reset()
Resets the node


getTime

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

setTime

public void setTime(double time)
Parameters:
time -

getConstant

public boolean getConstant()
Returns:
constant?

getNode

public ASTNode getNode()
Returns:
node the corresponding ASTNode

getValue

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

Parameters:
time -
Returns:
value the double or boolean value of the node

compileDouble

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

Parameters:
time -
delay -
Returns:
doubleValue the double value of the node

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:
booleanValue the boolean value of the node

computeDoubleValue

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

Parameters:
delay -

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:
name?

getName

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

Returns:
name

Generated at April 19 2013
Version 1.3 Revision 424