copasi API  0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
CEvaluationNode Class Reference

#include <CEvaluationNode.h>

Inheritance diagram for CEvaluationNode:
CCopasiNode< std::string > CEvaluationNodeCall CEvaluationNodeChoice CEvaluationNodeConstant CEvaluationNodeDelay CEvaluationNodeFunction CEvaluationNodeLogical CEvaluationNodeNumber CEvaluationNodeObject CEvaluationNodeOperator CEvaluationNodeStructure CEvaluationNodeVariable CEvaluationNodeVector CEvaluationNodeWhiteSpace

List of all members.

Classes

class  CPrecedence

Public Types

enum  Type {
  INVALID = 0xFF000000, NUMBER = 0x01000000, CONSTANT = 0x02000000, OPERATOR = 0x03000000,
  OBJECT = 0x04000000, FUNCTION = 0x05000000, CALL = 0x06000000, STRUCTURE = 0x07000000,
  CHOICE = 0x08000000, VARIABLE = 0x09000000, WHITESPACE = 0x0a000000, LOGICAL = 0x0b000000,
  MV_FUNCTION = 0x0c000000, VECTOR = 0x0d000000, DELAY = 0x0e000000
}

Public Member Functions

 CEvaluationNode ()
virtual bool operator!= (const CEvaluationNode &right) const
virtual bool operator== (const CEvaluationNode &right) const
virtual bool operator< (const CEvaluationNode &right) const
 CEvaluationNode (const CEvaluationNode &src)
virtual ~CEvaluationNode ()
virtual const C_FLOAT64 & value () const
virtual bool compile (const CEvaluationTree *pTree)
virtual std::string getInfix () const
virtual std::string getDisplayString (const CEvaluationTree *pTree) const
virtual std::string getDisplay_C_String (const CEvaluationTree *pTree) const
virtual std::string getDisplay_MMD_String (const CEvaluationTree *pTree) const
virtual std::string getDisplay_XPP_String (const CEvaluationTree *pTree) const
const TypegetType () const
virtual bool isBoolean () const
virtual ASTNode * toAST (const CCopasiDataModel *pDataModel) const
CEvaluationNodecopyNode (CEvaluationNode *child1, CEvaluationNode *child2) const
CEvaluationNodecopyNode (const std::vector< CEvaluationNode * > &children) const
CEvaluationNodecopyBranch () const
virtual CEvaluationNodesimplifyNode (const std::vector< CEvaluationNode * > &children) const
bool operator< (const CEvaluationNode &rhs)
const C_FLOAT64 * getValuePointer () const
virtual void writeMathML (std::ostream &out, const std::vector< std::vector< std::string > > &env, bool expand=true, unsigned C_INT32 l=0) const
void printRecursively (std::ostream &os, int indent=0) const
void printRecursively () const
CEvaluationNodesplitBranch (const CEvaluationNode *splitnode, bool left) const
const CEvaluationNodefindTopMinus (const std::vector< CFunctionAnalyzer::CValue > &callParameters) const

Static Public Member Functions

static CEvaluationNodecreate (const Type &type, const Data &data)
static Type subType (const Type &type)
static Type type (const Type &type)

Protected Member Functions

 CEvaluationNode (const Type &type, const Data &data)

Static Protected Member Functions

static void replaceRoot (ConverterASTNode *sourceNode)
static void replaceLog (ConverterASTNode *sourceNode)

Protected Attributes

Type mType
C_FLOAT64 mValue
class CEvaluationNode::CPrecedence mPrecedence

Detailed Description

This is the base class for nodes used in an evaluation trees


Member Enumeration Documentation

Enumeration of possible node types.

Enumerator:
INVALID 
NUMBER 
CONSTANT 
OPERATOR 
OBJECT 
FUNCTION 
CALL 
STRUCTURE 
CHOICE 
VARIABLE 
WHITESPACE 
LOGICAL 
MV_FUNCTION 
VECTOR 
DELAY 

Constructor & Destructor Documentation

CEvaluationNode::CEvaluationNode ( )

Default constructor

CEvaluationNode::CEvaluationNode ( const Type type,
const Data data 
) [protected]

Specific constructor

Parameters:
constType & type
constData & data
CEvaluationNode::CEvaluationNode ( const CEvaluationNode src)

Copy constructor

Parameters:
constCEvaluationNode & src
CEvaluationNode::~CEvaluationNode ( ) [virtual]

Destructor


Member Function Documentation

bool CEvaluationNode::compile ( const CEvaluationTree pTree) [virtual]
CEvaluationNode * CEvaluationNode::copyBranch ( ) const

Copy the whole branch with this node as root.

Returns:
CEvaluationNode*, return a pointer to the root of the newly copied branch
CEvaluationNode * CEvaluationNode::copyNode ( CEvaluationNode child1,
CEvaluationNode child2 
) const

Copy a node and assign new children child1 and child2

Returns:
CEvaluationNode* return a pointer to the new node
CEvaluationNode * CEvaluationNode::copyNode ( const std::vector< CEvaluationNode * > &  children) const

Copy a node and assign new children in the vector

Returns:
CEvaluationNode* return a pointer to the new node
CEvaluationNode * CEvaluationNode::create ( const Type type,
const Data data 
) [static]

Creates an evaluation node of type with the given data

Parameters:
constType & type
constData & data
Returns:
CEvaluationNode * evaluationNode
const CEvaluationNode * CEvaluationNode::findTopMinus ( const std::vector< CFunctionAnalyzer::CValue > &  callParameters) const

Find a minus operator in the tree that is suitable for splitting with splitBranch(). Specifically it is a minus operator that is connected with the root node by multiplication or division nodes only. For the division nodes only the left child is considered.

std::string CEvaluationNode::getDisplay_C_String ( const CEvaluationTree pTree) const [virtual]

Retrieve the display string of the node and its eventual child nodes in C.

Returns:
const Data & value

Reimplemented in CEvaluationNodeFunction, CEvaluationNodeLogical, CEvaluationNodeOperator, CEvaluationNodeObject, CEvaluationNodeCall, CEvaluationNodeChoice, CEvaluationNodeVector, CEvaluationNodeConstant, and CEvaluationNodeDelay.

std::string CEvaluationNode::getDisplay_MMD_String ( const CEvaluationTree pTree) const [virtual]

Retrieve the display string of the node and its eventual child nodes in Berkeley Madonna format.

Returns:
const Data & value

Reimplemented in CEvaluationNodeFunction, CEvaluationNodeLogical, CEvaluationNodeOperator, CEvaluationNodeObject, CEvaluationNodeCall, CEvaluationNodeChoice, CEvaluationNodeVector, CEvaluationNodeConstant, and CEvaluationNodeDelay.

std::string CEvaluationNode::getDisplay_XPP_String ( const CEvaluationTree pTree) const [virtual]

Retrieve the display string of the node and its eventual child nodes in XPPAUT format.

Returns:
const Data & value

Reimplemented in CEvaluationNodeFunction, CEvaluationNodeLogical, CEvaluationNodeOperator, CEvaluationNodeObject, CEvaluationNodeCall, CEvaluationNodeChoice, CEvaluationNodeVector, CEvaluationNodeConstant, and CEvaluationNodeDelay.

std::string CEvaluationNode::getDisplayString ( const CEvaluationTree pTree) const [virtual]

Retrieve the display string of the node and its eventual child nodes.

Returns:
const Data & value

Reimplemented in CEvaluationNodeFunction, CEvaluationNodeLogical, CEvaluationNodeOperator, CEvaluationNodeObject, CEvaluationNodeCall, CEvaluationNodeChoice, CEvaluationNodeVector, and CEvaluationNodeDelay.

std::string CEvaluationNode::getInfix ( ) const [virtual]

Retrieve the infix value of the node and its eventual child nodes.

Returns:
const Data & value

Reimplemented in CEvaluationNodeFunction, CEvaluationNodeLogical, CEvaluationNodeDelay, CEvaluationNodeOperator, CEvaluationNodeObject, CEvaluationNodeCall, CEvaluationNodeChoice, and CEvaluationNodeVector.

const CEvaluationNode::Type & CEvaluationNode::getType ( ) const

Retrieve the type of the node. Note the type combines type and subType information. To Retrieve the type use type(getType()) and to retrieve the subType use subType(getType()).

Returns:
const Type & type.
const C_FLOAT64 * CEvaluationNode::getValuePointer ( ) const

Retrieve the pointer to the value of the node

Returns:
const C_FLOAT64 * pValue
bool CEvaluationNode::isBoolean ( ) const [virtual]

Check whether the result is Boolean

Returns:
bool isBoolean

Reimplemented in CEvaluationNodeCall, CEvaluationNodeFunction, CEvaluationNodeLogical, and CEvaluationNodeConstant.

bool CEvaluationNode::operator!= ( const CEvaluationNode right) const [virtual]

Unequal operator, compares two CEvaluationNode objects and return true if they are equal.

bool CEvaluationNode::operator< ( const CEvaluationNode right) const [virtual]

Less operator, compares two CEvaluationNode objects and return true if the first operand is smaller than the second.

bool CEvaluationNode::operator< ( const CEvaluationNode rhs)

Comparison operator used to evaluate the precedence of the node. it compares the right precedence of the left node with the left precedence of the right node.

Parameters:
constCEvaluationNode & rhs;
Returns:
bool isLess
bool CEvaluationNode::operator== ( const CEvaluationNode right) const [virtual]

Equals operator, compares two CEvaluationNode objects and return true if they are equal.

void CEvaluationNode::printRecursively ( std::ostream &  os,
int  indent = 0 
) const
void CEvaluationNode::printRecursively ( ) const
void CEvaluationNode::replaceLog ( ConverterASTNode sourceNode) [static, protected]

Replaces all LOG10 (AST_FUNCTION_LOG) nodes that have two children with the quotient of two LOG10 nodes with the base as the argument for the divisor LOG10 node.

void CEvaluationNode::replaceRoot ( ConverterASTNode sourceNode) [static, protected]

Replaces all root nodes with the corresponding power operator since COPASI does not have the ROOT function.

CEvaluationNode * CEvaluationNode::simplifyNode ( const std::vector< CEvaluationNode * > &  children) const [virtual]

Create a simplified node from the original node with children child1 and child2 (if not exist, = NULL)

Returns:
CEvaluationNode* return a pointer to the simplified node;

Reimplemented in CEvaluationNodeFunction, and CEvaluationNodeOperator.

CEvaluationNode * CEvaluationNode::splitBranch ( const CEvaluationNode splitnode,
bool  left 
) const

Split the tree in two parts at the given splitnode, starting from *this. Returned is the root node of a copy of the tree, including everything above the split node and either the branch below the left child of the split node or the branch below the right child of the split node. The split node itself is not included either case.

CEvaluationNode::Type CEvaluationNode::subType ( const Type type) [static]

Retrieve the subtype part of type

Parameters:
constType & type
Returns:
Type subType
ASTNode * CEvaluationNode::toAST ( const CCopasiDataModel pDataModel) const [virtual]
CEvaluationNode::Type CEvaluationNode::type ( const Type type) [static]

Retrieve the type part of type

Parameters:
constType & type
Returns:
Type type
virtual const C_FLOAT64& CEvaluationNode::value ( ) const [inline, virtual]
void CEvaluationNode::writeMathML ( std::ostream &  out,
const std::vector< std::vector< std::string > > &  env,
bool  expand = true,
unsigned C_INT32  l = 0 
) const [virtual]

Member Data Documentation

The type the node

C_FLOAT64 CEvaluationNode::mValue [protected]

The numerical value of the node


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines