COPASI API  4.16.103
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Attributes | List of all members
CEvaluationNode Class Reference

#include <CEvaluationNode.h>

Inheritance diagram for CEvaluationNode:
Inheritance graph
[legend]
Collaboration diagram for CEvaluationNode:
Collaboration graph
[legend]

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 Types inherited from CCopasiNode< std::string >
typedef std::string Data
 

Public Member Functions

void addChildren (const std::vector< CEvaluationNode * > &children)
 
std::string buildBerkeleyMadonnaString () const
 
std::string buildCCodeString () const
 
std::string buildDisplayString () const
 
std::string buildInfix () const
 
std::string buildMMLString (bool expand, const std::vector< std::vector< std::string > > &variables) const
 
std::string buildXPPString () const
 
virtual void calculate ()
 
 CEvaluationNode ()
 
 CEvaluationNode (const CEvaluationNode &src)
 
virtual bool compile (const CEvaluationTree *pTree)
 
CEvaluationNodecopyBranch () const
 
CEvaluationNodecopyNode (CEvaluationNode *child1, CEvaluationNode *child2) const
 
CEvaluationNodecopyNode (const std::vector< CEvaluationNode * > &children) const
 
const CEvaluationNodefindTopMinus (const std::vector< CFunctionAnalyzer::CValue > &callParameters) const
 
virtual std::string getBerkeleyMadonnaString (const std::vector< std::string > &children) const
 
virtual std::string getCCodeString (const std::vector< std::string > &children) const
 
virtual std::string getDisplayString (const std::vector< std::string > &children) const
 
virtual std::string getInfix (const std::vector< std::string > &children) const
 
virtual std::string getMMLString (const std::vector< std::string > &children, bool expand, const std::vector< std::vector< std::string > > &variables) const
 
const TypegetType () const
 
const C_FLOAT64getValue () const
 
const C_FLOAT64getValuePointer () const
 
virtual std::string getXPPString (const std::vector< std::string > &children) const
 
virtual bool isBoolean () const
 
virtual bool operator!= (const CEvaluationNode &right) const
 
bool operator< (const CEvaluationNode &right) const
 
bool operator< (const CEvaluationNode &rhs)
 
bool operator== (const CEvaluationNode &right) const
 
void printRecursively (std::ostream &os, int indent=0) const
 
void printRecursively () const
 
virtual CEvaluationNodesimplifyNode (const std::vector< CEvaluationNode * > &children) const
 
CEvaluationNodesplitBranch (const CEvaluationNode *splitnode, bool left) const
 
virtual ASTNode * toAST (const CCopasiDataModel *pDataModel) const
 
virtual ~CEvaluationNode ()
 
- Public Member Functions inherited from CCopasiNode< std::string >
virtual bool addChild (CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
 
bool addSibling (CCopasiNode< Data > *pSibling, CCopasiNode< Data > *pAfter=NULL)
 
 CCopasiNode (CCopasiNode< Data > *pParent=NULL)
 
 CCopasiNode (const CCopasiNode< Data > &src)
 
 CCopasiNode (const Data &data, CCopasiNode< Data > *pParent=NULL)
 
bool deleteChildren ()
 
CCopasiNode< Data > * getChild ()
 
const CCopasiNode< Data > * getChild () const
 
CCopasiNode< Data > * getChild (const size_t &index)
 
const CCopasiNode< Data > * getChild (const size_t &index) const
 
virtual const DatagetData () const
 
CCopasiNode< Data > * getNext ()
 
const CCopasiNode< Data > * getNext () const
 
CCopasiNode< Data > * getNextNonChild ()
 
const CCopasiNode< Data > * getNextNonChild () const
 
size_t getNumChildren () const
 
CCopasiNode< Data > * getParent ()
 
const CCopasiNode< Data > * getParent () const
 
CCopasiNode< Data > * getSibling ()
 
const CCopasiNode< Data > * getSibling () const
 
virtual bool removeChild (CCopasiNode< Data > *pChild)
 
virtual bool setData (const Data &data)
 
virtual ~CCopasiNode ()
 

Static Public Member Functions

static CEvaluationNodecreate (const Type &type, const Data &data)
 
static bool isKeyword (const std::string &str)
 
static Type subType (const Type &type)
 
static Type type (const Type &type)
 

Protected Member Functions

 CEvaluationNode (const Type &type, const Data &data)
 
- Protected Member Functions inherited from CCopasiNode< std::string >
bool setChild (CCopasiNode< Data > *pChild)
 
bool setParent (CCopasiNode< Data > *pParent)
 
bool setSibling (CCopasiNode< Data > *pSibling)
 

Protected Attributes

class CEvaluationNode::CPrecedence mPrecedence
 
const C_FLOAT64mpValue
 
Type mType
 
C_FLOAT64 mValue
 
- Protected Attributes inherited from CCopasiNode< std::string >
Data mData
 

Static Private Attributes

static const char * Keywords []
 

Detailed Description

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

Definition at line 33 of file CEvaluationNode.h.

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 

Definition at line 39 of file CEvaluationNode.h.

40  {
41  INVALID = 0xFF000000,
42  NUMBER = 0x01000000,
43  CONSTANT = 0x02000000,
44  OPERATOR = 0x03000000,
45  OBJECT = 0x04000000,
46  FUNCTION = 0x05000000,
47  CALL = 0x06000000,
48  STRUCTURE = 0x07000000,
49  CHOICE = 0x08000000,
50  VARIABLE = 0x09000000,
51  WHITESPACE = 0x0a000000,
52  LOGICAL = 0x0b000000,
53  MV_FUNCTION = 0x0c000000, // This not yet implemented
54  VECTOR = 0x0d000000,
55  DELAY = 0x0e000000
56  };

Constructor & Destructor Documentation

CEvaluationNode::CEvaluationNode ( )

Default constructor

Definition at line 183 of file CEvaluationNode.cpp.

References mpValue, and mValue.

Referenced by create().

183  :
184  CCopasiNode<Data>(""),
186  mValue(std::numeric_limits<C_FLOAT64>::quiet_NaN()),
187  mpValue(NULL),
189 {
190  mpValue = & mValue;
191 }
class CEvaluationNode::CPrecedence mPrecedence
#define PRECEDENCE_DEFAULT
const C_FLOAT64 * mpValue
CEvaluationNode::CEvaluationNode ( const Type type,
const Data data 
)
protected

Specific constructor

Parameters
constType & type
constData & data

Definition at line 193 of file CEvaluationNode.cpp.

References mpValue, and mValue.

194  :
195  CCopasiNode<Data>(data),
196  mType(type),
197  mValue(std::numeric_limits<C_FLOAT64>::quiet_NaN()),
198  mpValue(NULL),
200 {
201  mpValue = & mValue;
202 }
static Type type(const Type &type)
class CEvaluationNode::CPrecedence mPrecedence
#define PRECEDENCE_DEFAULT
const C_FLOAT64 * mpValue
CEvaluationNode::CEvaluationNode ( const CEvaluationNode src)

Copy constructor

Parameters
constCEvaluationNode & src

Definition at line 204 of file CEvaluationNode.cpp.

References mpValue, and mValue.

204  :
205  CCopasiNode<Data>(src),
206  mType(src.mType),
207  mValue(src.mValue),
208  mpValue(NULL),
210 {
211  mpValue = & mValue;
212 }
class CEvaluationNode::CPrecedence mPrecedence
const C_FLOAT64 * mpValue
CEvaluationNode::~CEvaluationNode ( )
virtual

Destructor

Definition at line 214 of file CEvaluationNode.cpp.

214 {}

Member Function Documentation

void CEvaluationNode::addChildren ( const std::vector< CEvaluationNode * > &  children)

Add the children to the node

Parameters
conststd::vector< CEvaluationNode * > & children

Definition at line 364 of file CEvaluationNode.cpp.

References CCopasiNode< std::string >::addChild().

Referenced by CEvaluationNodeCall::fromAST().

365 {
366  std::vector< CEvaluationNode * >::const_iterator it = children.begin();
367  std::vector< CEvaluationNode * >::const_iterator end = children.end();
368 
369  for (; it != end; ++it)
370  {
371  addChild(*it);
372  }
373 }
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
Definition: CCopasiNode.h:156
std::string CEvaluationNode::buildBerkeleyMadonnaString ( ) const

Build the Berkeley Madonna string.

Returns
std::string BerkeleyMadonnaString

Definition at line 307 of file CEvaluationNode.cpp.

References CNodeContextIterator< Node, Context >::context(), CNodeContextIterator< Node, Context >::end(), getBerkeleyMadonnaString(), CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::parentContextPtr().

Referenced by CExpression::getBerkeleyMadonnaString(), CODEExporterBM::getDisplayExpressionString(), and CODEExporterBM::getDisplayFunctionString().

308 {
309  std::string BerkeleyMadonnaString = "";
311 
312  while (it.next() != it.end())
313  {
314  if (*it != NULL)
315  {
316  if (it.parentContextPtr() != NULL)
317  {
318  it.parentContextPtr()->push_back(it->getBerkeleyMadonnaString(it.context()));
319  }
320  else
321  {
322  BerkeleyMadonnaString = it->getBerkeleyMadonnaString(it.context());
323  }
324  }
325  }
326 
327  return BerkeleyMadonnaString;
328 }
std::string CEvaluationNode::buildCCodeString ( ) const

Build the C-code string.

Returns
std::string CCodeString

Build the C-code string.

Definition at line 280 of file CEvaluationNode.cpp.

References CNodeContextIterator< Node, Context >::context(), CNodeContextIterator< Node, Context >::end(), getCCodeString(), CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::parentContextPtr().

Referenced by CODEExporterC::exportSingleFunction(), CExpression::getCCodeString(), and CODEExporterC::getDisplayExpressionString().

281 {
282  std::string CCodeString = "";
284 
285  while (it.next() != it.end())
286  {
287  if (*it != NULL)
288  {
289  if (it.parentContextPtr() != NULL)
290  {
291  it.parentContextPtr()->push_back(it->getCCodeString(it.context()));
292  }
293  else
294  {
295  CCodeString = it->getCCodeString(it.context());
296  }
297  }
298  }
299 
300  return CCodeString;
301 }
std::string CEvaluationNode::buildDisplayString ( ) const

Build the human readable display string.

Returns
std::string DisplayString

Definition at line 250 of file CEvaluationNode.cpp.

References CNodeContextIterator< Node, Context >::context(), CNodeContextIterator< Node, Context >::end(), getDisplayString(), CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::parentContextPtr().

Referenced by CExpression::compile().

251 {
252  std::string DisplayString = "";
254 
255  while (it.next() != it.end())
256  {
257  if (*it != NULL)
258  {
259  if (it.parentContextPtr() != NULL)
260  {
261  it.parentContextPtr()->push_back(it->getDisplayString(it.context()));
262  }
263  else
264  {
265  DisplayString = it->getDisplayString(it.context());
266  }
267  }
268  }
269 
270  return DisplayString;
271 }
std::string CEvaluationNode::buildInfix ( ) const

Build the infix string.

Returns
std::string Infix

Definition at line 223 of file CEvaluationNode.cpp.

References CNodeContextIterator< Node, Context >::context(), CNodeContextIterator< Node, Context >::end(), getInfix(), CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::parentContextPtr().

Referenced by CExpression::compile(), CMathExpression::convertToInitialExpression(), createItem(), CKinFunction::createParameters(), CNormalTranslation::eliminate(), CNormalTranslation::matchPowerBases(), CNormalTranslation::matchSummands(), CNormalTranslation::normAndSimplifyReptdly(), operator<<(), CMathContainer::replaceDiscontinuousNode(), CNormalTranslation::simplify(), CEvaluationNodeOperator::simplifyNode(), CNormalTranslation::simplifyTreeReptdly(), CExpression::updateInfix(), and CEvaluationTree::updateTree().

224 {
225  std::string Infix = "";
227 
228  while (it.next() != it.end())
229  {
230  if (*it != NULL)
231  {
232  if (it.parentContextPtr() != NULL)
233  {
234  it.parentContextPtr()->push_back(it->getInfix(it.context()));
235  }
236  else
237  {
238  Infix = it->getInfix(it.context());
239  }
240  }
241  }
242 
243  return Infix;
244 }
std::string CEvaluationNode::buildMMLString ( bool  expand,
const std::vector< std::vector< std::string > > &  variables 
) const

Build the MathML string

Parameters
boolexpand = true
conststd::vector< std::vector< std::string > > & variables
Returns
std::string MMLString

Definition at line 452 of file CEvaluationNode.cpp.

References CNodeContextIterator< Node, Context >::context(), CNodeContextIterator< Node, Context >::end(), getMMLString(), CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::parentContextPtr().

Referenced by CExpression::writeMathML(), and CFunction::writeMathML().

454 {
455  std::string MMLString = "";
457 
458  while (it.next() != it.end())
459  {
460  if (*it != NULL)
461  {
462  if (it.parentContextPtr() != NULL)
463  {
464  it.parentContextPtr()->push_back(it->getMMLString(it.context(), expand, variables));
465  }
466  else
467  {
468  MMLString = it->getMMLString(it.context(), expand, variables);
469  }
470  }
471  }
472 
473  return MMLString;
474 }
std::string CEvaluationNode::buildXPPString ( ) const

Build the XPPAUT string.

Returns
std::string XPPString

Definition at line 334 of file CEvaluationNode.cpp.

References CNodeContextIterator< Node, Context >::context(), CNodeContextIterator< Node, Context >::end(), getXPPString(), CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::parentContextPtr().

Referenced by CODEExporterXPPAUT::getDisplayExpressionString(), CODEExporterXPPAUT::getDisplayFunctionString(), and CExpression::getXPPString().

335 {
336  std::string BerkeleyMadonnaString = "";
338 
339  while (it.next() != it.end())
340  {
341  if (*it != NULL)
342  {
343  if (it.parentContextPtr() != NULL)
344  {
345  it.parentContextPtr()->push_back(it->getXPPString(it.context()));
346  }
347  else
348  {
349  BerkeleyMadonnaString = it->getXPPString(it.context());
350  }
351  }
352  }
353 
354  return BerkeleyMadonnaString;
355 }
virtual void CEvaluationNode::calculate ( void  )
inlinevirtual

Calculate the numerical result of the node. It is assumed that all child nodes are up to date.

Reimplemented in CEvaluationNodeFunction, CEvaluationNodeLogical, CEvaluationNodeVariable, CEvaluationNodeOperator, CEvaluationNodeChoice, and CEvaluationNodeCall.

Definition at line 150 of file CEvaluationNode.h.

150 {};
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

Definition at line 404 of file CEvaluationNode.cpp.

References CNodeContextIterator< Node, Context >::context(), copyNode(), CNodeContextIterator< Node, Context >::end(), CNodeContextIterator< Node, Context >::next(), and CNodeContextIterator< Node, Context >::parentContextPtr().

Referenced by CODEExporter::assembleSubTreeForMassAction(), CMathTrigger::compileNE(), convertToCEvaluationNode(), CMathExpression::copy(), CMathTrigger::copyBranch(), CNormalTranslation::createChain(), CFunction::createCopy(), SBMLImporter::createCReactionFromReaction(), createLogical(), createNormalRepresentation(), CNormalTranslation::createOperatorChain(), createProduct(), CDerive::deriveBranch(), SBMLImporter::divideByObject(), CNormalTranslation::elementaryEliminationDivide(), CNormalTranslation::elementaryEliminationFunction(), CNormalTranslation::elementaryEliminationMinus(), CNormalTranslation::elementaryEliminationMultiply(), CNormalTranslation::elementaryEliminationPlus(), CNormalTranslation::elementaryEliminationPower(), CNormalTranslation::eliminate(), CNormalTranslation::eliminateDirectlyNestedFractions(), CNormalTranslation::eliminateNestedPowers(), CNormalTranslation::eliminatePowersOfFractions(), expand_function_call(), CNormalTranslation::expandPowerBases(), CNormalTranslation::expandPowerNodes(), CODEExporter::exportSingleFunction(), CEvaluationNodeNormalizer::findChainNodes(), CNormalTranslation::findNegativeNumbers(), SBMLImporter::isMassActionExpression(), CNormalTranslation::matchPowerBases(), CNormalTranslation::matchSummands(), CSBMLExporter::multiplyByObject(), CNormalTranslation::newCancel(), CNormalTranslation::newEvaluateNumbers(), CEvaluationNodeNormalizer::normalize(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeCall(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeChoice(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeConstant(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeDelay(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeFunction(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeLogical(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeNumber(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeObject(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeOperator(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeStructure(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeVariable(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeVector(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeWhiteSpace(), CEvaluationNodeNormalizer::normalizeDivideNode(), CEvaluationNodeNormalizer::normalizeMinusNode(), CEvaluationNodeNormalizer::normalizeModulusNode(), CEvaluationNodeNormalizer::normalizeMultiplyNode(), CEvaluationNodeNormalizer::normalizePlusNode(), CEvaluationNodeNormalizer::normalizePowerNode(), CNormalTranslation::product2fraction(), CSBMLExporter::replaceSpeciesReferences(), CReaction::setFunctionFromExpressionTree(), CNormalTranslation::simplify(), CEvaluationNodeOperator::simplifyNode(), CEvaluationNodeFunction::simplifyNode(), splitBranch(), and CNormalTranslation::splitSum().

405 {
406  CEvaluationNode * pNode = NULL;
408 
409  while (itNode.next() != itNode.end())
410  {
411  if (*itNode == NULL)
412  {
413  continue;
414  }
415 
416  if (itNode.parentContextPtr() != NULL)
417  {
418  itNode.parentContextPtr()->push_back(itNode->copyNode(itNode.context()));
419  }
420  else
421  {
422  assert(*itNode == this);
423  pNode = itNode->copyNode(itNode.context());
424  }
425  }
426 
427  return pNode;
428 }
CEvaluationNode * copyNode(CEvaluationNode *child1, CEvaluationNode *child2) const
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

Definition at line 378 of file CEvaluationNode.cpp.

Referenced by CMathEventN::CTrigger::compile(), CMathContainer::copyBranch(), copyBranch(), CNormalTranslation::eliminateDirectlyNestedFractions(), CNormalTranslation::eliminateNestedPowers(), CNormalTranslation::eliminatePowersOfFractions(), expand_function_calls(), CNormalTranslation::expandPowerBases(), CNormalTranslation::expandPowerNodes(), CNormalTranslation::expandProducts(), CNormalTranslation::findNegativeNumbers(), CReaction::objects2variables(), CNormalTranslation::product2fraction(), replace_variable_names(), CMathContainer::replaceDiscontinuousNode(), CSBMLExporter::replaceSpeciesReferences(), CEvaluationNodeOperator::simplifyNode(), CEvaluationNodeFunction::simplifyNode(), simplifyNode(), and splitBranch().

379 {
380  std::vector<CEvaluationNode*> children;
381 
382  if (child1 != NULL) children.push_back(child1);
383 
384  if (child2 != NULL) children.push_back(child2);
385 
386  return copyNode(children);
387 }
CEvaluationNode * copyNode(CEvaluationNode *child1, CEvaluationNode *child2) const
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

Definition at line 389 of file CEvaluationNode.cpp.

References CCopasiNode< _Data >::addChild(), create(), CCopasiNode< std::string >::getData(), and mType.

390 {
391  CEvaluationNode * pNode = create(mType, getData());
392  std::vector<CEvaluationNode*>::const_iterator it = children.begin();
393  std::vector<CEvaluationNode*>::const_iterator endit = children.end();
394 
395  while (it != endit)
396  {
397  pNode->addChild(*it);
398  ++it;
399  }
400 
401  return pNode;
402 }
static CEvaluationNode * create(const Type &type, const Data &data)
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
Definition: CCopasiNode.h:156
virtual const Data & getData() const
Definition: CCopasiNode.h:118
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

Definition at line 37 of file CEvaluationNode.cpp.

References CALL, CEvaluationNode(), CHOICE, CONSTANT, DELAY, FUNCTION, INVALID, LOGICAL, MV_FUNCTION, NUMBER, OBJECT, OPERATOR, STRUCTURE, subType(), type(), VARIABLE, VECTOR, and WHITESPACE.

Referenced by CODEExporter::assembleSubTreeForMassAction(), CEvaluationNodeNormalizer::collectIdenticalBranches(), copyNode(), CNormalTranslation::expandPowerExponents(), CODEExporter::modifyTreeForMassAction(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeCall(), CEvaluationNodeOperator::simplifyNode(), CEvaluationNodeFunction::simplifyNode(), and SBMLImporter::variables2objects().

39 {
40  CEvaluationNode * pNode = NULL;
41 
42  switch (CEvaluationNode::type(type))
43  {
46  contents);
47  break;
48 
51  contents);
52  break;
53 
56  contents);
57  break;
58 
61  contents);
62  break;
63 
66  contents);
67  break;
68 
71  contents);
72  break;
73 
76  contents);
77  break;
78 
81  contents);
82  break;
83 
86  contents);
87  break;
88 
91  contents);
92  break;
93 
96  contents);
97  break;
98 
101  contents);
102  break;
103 
106  contents);
107  break;
108 
110  pNode = new CEvaluationNode();
111  break;
112 
114  break;
115  }
116 
117  return pNode;
118 }
static Type type(const Type &type)
static Type subType(const Type &type)
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.

Definition at line 566 of file CEvaluationNode.cpp.

References CNodeIteratorMode::After, CNodeIteratorMode::Before, CNodeContextIterator< Node, Context >::context(), CEvaluationNodeOperator::DIVIDE, CNodeContextIterator< Node, Context >::end(), CFunctionAnalyzer::evaluateNode(), CCopasiNode< _Data >::getChild(), CCopasiNode< _Data >::getData(), getType(), CFunctionAnalyzer::CValue::isPositive(), CEvaluationNodeOperator::MINUS, CEvaluationNodeOperator::MULTIPLY, CNodeContextIterator< Node, Context >::next(), CFunctionAnalyzer::NOOBJECT, OPERATOR, CNodeContextIterator< Node, Context >::parentContextPtr(), CNodeContextIterator< Node, Context >::processingMode(), CNodeContextIterator< Node, Context >::setProcessingModes(), and CNodeContextIterator< Node, Context >::skipChildren().

Referenced by CFunction::splitFunction().

567 {
569  itNode.setProcessingModes(CNodeIteratorMode::Before | CNodeIteratorMode::After);
570  const CEvaluationNode * pMinus = NULL;
571 
572  while (itNode.next() != itNode.end())
573  {
574  if (*itNode == NULL)
575  {
576  continue;
577  }
578 
579 #ifdef COPASI_DEBUG
580  std::cout << itNode->getData() << std::endl;
581 #endif
582 
583  switch (itNode.processingMode())
584  {
586 
587  if (itNode->getType() == (OPERATOR | CEvaluationNodeOperator::MINUS))
588  {
589  // We found a minus no need to go down the tree.
590  itNode.skipChildren();
591  pMinus = *itNode;
592 
593  if (itNode.parentContextPtr() != NULL)
594  {
595  itNode.parentContextPtr()->push_back(pMinus);
596  }
597  }
598 
599  break;
600 
602 
603  if (itNode->getType() == (OPERATOR | CEvaluationNodeOperator::MULTIPLY))
604  {
605  // Left child
606  if (itNode.context()[0] != NULL)
607  {
608  // Both children contain a minus, this is not a valid split point.
609 
610  if (itNode.context()[1] != NULL)
611  {
612  pMinus = NULL;
613  }
614  // Check whether the right is positive
615  else if (CFunctionAnalyzer::evaluateNode(static_cast< const CEvaluationNode *>(itNode->getChild(1)),
616  callParameters, CFunctionAnalyzer::NOOBJECT).isPositive())
617  {
618  pMinus = itNode.context()[0];
619  }
620  else
621  {
622  pMinus = NULL;
623  }
624  }
625  // Right child
626  else if (itNode.context()[1] != NULL)
627  {
628  // Check whether the left is positive
629  if (CFunctionAnalyzer::evaluateNode(static_cast< const CEvaluationNode *>(itNode->getChild(0)),
630  callParameters, CFunctionAnalyzer::NOOBJECT).isPositive())
631  pMinus = itNode.context()[1];
632  else
633  pMinus = NULL;
634  }
635  else
636  {
637  pMinus = NULL;
638  }
639  }
640  else if (itNode->getType() == (OPERATOR | CEvaluationNodeOperator::DIVIDE))
641  {
642  // Left child
643  pMinus = itNode.context()[0];
644  }
645  else
646  {
647  pMinus = NULL;
648  }
649 
650  if (itNode.parentContextPtr() != NULL)
651  {
652  itNode.parentContextPtr()->push_back(pMinus);
653  }
654 
655  break;
656 
657  default:
658  // This will never happen
659  break;
660  }
661  }
662 
663  return pMinus;
664 }
static CValue evaluateNode(const CEvaluationNode *node, const std::vector< CValue > &callParameters, Mode mode)
virtual const Data & getData() const
Definition: CCopasiNode.h:118
std::string CEvaluationNode::getBerkeleyMadonnaString ( const std::vector< std::string > &  children) const
virtual

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

Returns
std::string BerkeleyMadonnaString

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

Definition at line 304 of file CEvaluationNode.cpp.

References CCopasiNode< std::string >::mData.

Referenced by buildBerkeleyMadonnaString().

305 {return mData;}
std::string CEvaluationNode::getCCodeString ( const std::vector< std::string > &  children) const
virtual

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

Returns
std::string CCodeString

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

Definition at line 274 of file CEvaluationNode.cpp.

References CCopasiNode< std::string >::mData.

Referenced by buildCCodeString().

275 {return mData;}
std::string CEvaluationNode::getDisplayString ( const std::vector< std::string > &  children) const
virtual

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

Returns
std::string DisplayString

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

Definition at line 247 of file CEvaluationNode.cpp.

References CCopasiNode< std::string >::mData.

Referenced by buildDisplayString().

248 {return mData;}
std::string CEvaluationNode::getInfix ( const std::vector< std::string > &  children) const
virtual

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

Returns
std::string Infix

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

Definition at line 220 of file CEvaluationNode.cpp.

References CCopasiNode< std::string >::mData.

Referenced by buildInfix().

221 {return mData;}
std::string CEvaluationNode::getMMLString ( const std::vector< std::string > &  children,
bool  expand,
const std::vector< std::vector< std::string > > &  variables 
) const
virtual

Build the MathML string

Parameters
conststd::vector< std::string > & children
boolexpand = true
conststd::vector< std::vector< std::string > > & variables
Returns
std::string MMLString

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

Definition at line 445 of file CEvaluationNode.cpp.

Referenced by buildMMLString().

448 {
449  return "";
450 }
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.

Definition at line 357 of file CEvaluationNode.cpp.

References mType.

Referenced by SBMLImporter::areEqualSubtrees(), CODEExporter::assembleSubTreeForMassAction(), CEvaluationTree::buildCalculationSequence(), CSBMLExporter::checkForPiecewiseFunctions(), CSBMLExporter::checkForUnsupportedFunctionCalls(), CEvaluationNodeNormalizer::collectIdenticalBranches(), CMathEventN::CTrigger::compile(), CMathTrigger::compile(), CMathEventN::CTrigger::compileAND(), CMathTrigger::compileEQ(), CMathEventN::CTrigger::compileLE(), CMathTrigger::copyBranch(), CMathContainer::copyBranch(), CMathEventN::CTrigger::countRoots(), createCall(), createChoice(), SBMLImporter::createCReactionFromReaction(), CMathContainer::createDiscontinuityTriggerInfix(), CSBMLExporter::createEvent(), createFunction(), createGeneralPower(), CSBMLExporter::createInitialAssignment(), createItem(), createItemPower(), createItemPowerItem(), createLogical(), createLogicalChoice(), createLogicalItem(), CEvaluationNodeOperator::createModuloTree(), createNormalRepresentation(), createProduct(), CSBMLExporter::createRule(), createSum(), CDerive::deriveBranch(), SBMLImporter::divideByObject(), CNormalTranslation::elementaryElimination(), CNormalTranslation::elementaryEliminationDivide(), CNormalTranslation::elementaryEliminationFunction(), CNormalTranslation::elementaryEliminationMinus(), CNormalTranslation::elementaryEliminationModulus(), CNormalTranslation::elementaryEliminationMultiply(), CNormalTranslation::elementaryEliminationPlus(), CNormalTranslation::elementaryEliminationPower(), CNormalTranslation::eliminateDirectlyNestedFractions(), CNormalTranslation::eliminateNestedPowers(), CNormalTranslation::eliminatePowersOfFractions(), CFunctionAnalyzer::evaluateNode(), CNormalTranslation::expandPowerBases(), CNormalTranslation::expandPowerExponents(), CNormalTranslation::expandPowerNodes(), CNormalTranslation::expandProducts(), CSBMLExporter::exportEventAssignments(), CNormalTranslation::factorize(), CEvaluationNodeNormalizer::findChainNodes(), CFindDimensions::findDimension(), CSBMLExporter::findDirectlyUsedFunctions(), CSBMLExporter::findModelEntityDependencies(), CNormalTranslation::findNegativeNumbers(), CNormalTranslation::findSummands(), findTopMinus(), CEvaluationNodeConstant::getBerkeleyMadonnaString(), CEvaluationNodeLogical::getBerkeleyMadonnaString(), CEvaluationNodeFunction::getBerkeleyMadonnaString(), CEvaluationNodeConstant::getCCodeString(), CEvaluationNodeOperator::getCCodeString(), CEvaluationNodeLogical::getCCodeString(), CEvaluationNodeFunction::getCCodeString(), CEvaluationNodeConstant::getMMLString(), CEvaluationNodeOperator::getMMLString(), CEvaluationNodeLogical::getMMLString(), CEvaluationNodeFunction::getMMLString(), CEvaluationNodeConstant::getXPPString(), CEvaluationNodeOperator::getXPPString(), CEvaluationNodeLogical::getXPPString(), CEvaluationNodeFunction::getXPPString(), CEvaluationNodeFunction::handleNot(), CEvaluationNodeFunction::handleSign(), SBMLImporter::isConstantFlux(), CSBMLExporter::isEventAssignmentSBMLCompatible(), isLogical(), SBMLImporter::isMassAction(), SBMLImporter::isMassActionExpression(), CMathObject::isPrerequisiteForContext(), CNormalTranslation::matchPowerBases(), CNormalTranslation::matchSummands(), CSBMLExporter::multiplyByObject(), CNormalTranslation::newCancel(), CNormalTranslation::newEvaluateNumbers(), CEvaluationNodeNormalizer::normalize(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeCall(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeChoice(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeDelay(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeFunction(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeLogical(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeOperator(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeVector(), CEvaluationNodeNormalizer::normalizeDivideNode(), CEvaluationNodeNormalizer::normalizeMinusNode(), CEvaluationNodeNormalizer::normalizeModulusNode(), CEvaluationNodeNormalizer::normalizeMultiplyNode(), CEvaluationNodeNormalizer::normalizePlusNode(), CEvaluationNodeNormalizer::normalizePowerNode(), CReaction::objects2variables(), operator<(), operator==(), CNormalTranslation::product2fraction(), CSBMLExporter::replaceSpeciesReferences(), SBMLImporter::separateProductArguments(), setBooleanRequired(), CSBMLExporter::setFunctionSBMLIds(), CEvaluationNodeOperator::simplifyNode(), CNormalTranslation::splitProduct(), CNormalTranslation::splitSum(), CNormalTranslation::swapNegativeNumbers(), test000053::test1_bug1000(), test000053::test2_bug1000(), test000053::test3_bug1000(), test000053::test4_bug1000(), test000053::test5_bug1000(), test000093::test_bug1503_1(), test000093::test_bug1503_2(), test000052::test_bug988(), test_compare_utilities::test_copasi_function_expansion(), test000091::test_delay_in_kinetic_law(), test000091::test_delay_in_kinetic_law_local_parameter(), test_depth_first_iterator::test_dfi(), test000042::test_hasOnlySubstanceUnits(), test000026::test_hasOnlySubstanceUnits(), test000040::test_hasOnlySubstanceUnits(), test000023::test_hasOnlySubstanceUnits(), test000043::test_hasOnlySubstanceUnits(), test000025::test_hasOnlySubstanceUnits(), test000033::test_hasOnlySubstanceUnits(), test000082::test_import_delayAssignment_1(), test000082::test_import_delayAssignment_2(), test000082::test_import_delayAssignment_3(), test000082::test_import_delayAssignment_4(), test000082::test_import_delayAssignment_5(), test000082::test_import_delayAssignment_6(), test000082::test_import_delayAssignment_7(), test000082::test_import_delayAssignment_8(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_1(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_2(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_3(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_4(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_5(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_6(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_7(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_8(), test000095::test_import_l3_event_1(), test000095::test_import_l3_event_2(), test000095::test_import_l3_event_3(), test000095::test_import_l3_event_4(), test000095::test_import_l3_event_5(), test000087::test_import_reaction_flux_reference_2(), test000065::test_import_reaction_with_unsuitable_kinetic_1(), test000065::test_import_reaction_with_unsuitable_kinetic_2(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_1(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_2(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_3(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_4(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_5(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_6(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_7(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_8(), test000075::test_import_time_dependent_function_definition(), test000078::test_l2v4_import_unordered_functions(), test000087::test_simulate_reaction_flux_reference_1(), CEvaluationNodeNumber::toAST(), CEvaluationNodeConstant::toAST(), CEvaluationNodeOperator::toAST(), CEvaluationNodeLogical::toAST(), CEvaluationNodeFunction::toAST(), SBMLImporter::variables2objects(), CReaction::variables2objects(), and CEvaluationNodeCall::verifyParameters().

358 {return mType;}
const C_FLOAT64& CEvaluationNode::getValue ( ) const
inline

Retrieve the value of the node

Returns
const C_FLOAT64 & value

Definition at line 144 of file CEvaluationNode.h.

References mpValue.

Referenced by CEvaluationNodeChoice::calculate(), CEvaluationNodeOperator::calculate(), CEvaluationNodeLogical::calculate(), CEvaluationNodeFunction::calculate(), CEvaluationTree::calculate(), createProduct(), CNormalTranslation::elementaryEliminationModulus(), CNormalTranslation::elementaryEliminationPower(), CEvaluationNodeNormalizer::eliminateMultipleNumbers(), CFunctionAnalyzer::evaluateNode(), CFindDimensions::findDimension(), CNormalTranslation::findNegativeNumbers(), CEvaluationNodeNumber::getCCodeString(), SBMLImporter::isMassActionExpression(), CNormalTranslation::matchPowerBases(), CNormalTranslation::matchSummands(), CNormalTranslation::newEvaluateNumbers(), CEvaluationNodeNormalizer::normalizeDivideNode(), CEvaluationNodeNormalizer::normalizeMinusNode(), CEvaluationNodeNormalizer::normalizeModulusNode(), CEvaluationNodeNormalizer::normalizeMultiplyNode(), CEvaluationNodeNormalizer::normalizePlusNode(), CEvaluationNodeNormalizer::normalizePowerNode(), CEvaluationNodeOperator::simplifyNode(), CNormalTranslation::splitSum(), CNormalTranslation::swapNegativeNumbers(), test000093::test_bug1503_1(), test000093::test_bug1503_2(), test_depth_first_iterator::test_dfi(), test000082::test_import_delayAssignment_1(), test000082::test_import_delayAssignment_2(), test000082::test_import_delayAssignment_3(), test000082::test_import_delayAssignment_4(), test000082::test_import_delayAssignment_5(), test000082::test_import_delayAssignment_6(), test000082::test_import_delayAssignment_7(), test000082::test_import_delayAssignment_8(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_1(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_2(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_3(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_4(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_5(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_6(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_7(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_8(), test000095::test_import_l3_event_1(), test000095::test_import_l3_event_2(), test000095::test_import_l3_event_3(), test000095::test_import_l3_event_4(), test000095::test_import_l3_event_5(), test000078::test_l2v4_import_unordered_functions(), and CEvaluationNodeNumber::toAST().

144 {return *mpValue;}
const C_FLOAT64 * mpValue
const C_FLOAT64 * CEvaluationNode::getValuePointer ( ) const

Retrieve the pointer to the value of the node

Returns
const C_FLOAT64 * pValue

Definition at line 441 of file CEvaluationNode.cpp.

References mpValue.

442 {return mpValue;}
const C_FLOAT64 * mpValue
std::string CEvaluationNode::getXPPString ( const std::vector< std::string > &  children) const
virtual

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

Returns
std::string XPPString

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

Definition at line 331 of file CEvaluationNode.cpp.

References CCopasiNode< std::string >::mData.

Referenced by buildXPPString().

332 {return mData;}
bool CEvaluationNode::isBoolean ( ) const
virtual
bool CEvaluationNode::isKeyword ( const std::string &  str)
static

Check whether the string is a keyword

Parameters
conststd::string & str
Returns
bool isKeyword

Definition at line 173 of file CEvaluationNode.cpp.

References Keywords.

Referenced by CEvaluationNodeCall::CEvaluationNodeCall(), CEvaluationNodeCall::getData(), and CEvaluationNodeCall::setData().

174 {
175  const char ** pKeyword = Keywords;
176 
177  for (; *pKeyword != NULL; ++pKeyword)
178  if (!strcmp(str.c_str(), *pKeyword)) return true;
179 
180  return false;
181 }
static const char * Keywords[]
bool CEvaluationNode::operator!= ( const CEvaluationNode right) const
virtual

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

Definition at line 666 of file CEvaluationNode.cpp.

667 {
668  return !(*this == right);
669 }
bool CEvaluationNode::operator< ( const CEvaluationNode right) const

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

Definition at line 699 of file CEvaluationNode.cpp.

References CALL, CHOICE, CONSTANT, DELAY, FUNCTION, CCopasiNode< std::string >::getChild(), CCopasiNode< _Data >::getChild(), CCopasiNode< std::string >::getData(), CCopasiNode< _Data >::getData(), CCopasiNode< _Data >::getSibling(), getType(), INVALID, LOGICAL, MV_FUNCTION, NUMBER, OBJECT, OPERATOR, STRUCTURE, type(), VARIABLE, VECTOR, and WHITESPACE.

700 {
701  bool result = false;
702 
703  if (this->getType() < right.getType())
704  {
705  result = true;
706  }
707  else if (this->getType() == right.getType())
708  {
709  switch (CEvaluationNode::type(this->getType()))
710  {
718  result = (this->getData() < right.getData());
719  break;
720 
729  break;
730  }
731 
732  const CEvaluationNode* pChild1 = dynamic_cast<const CEvaluationNode*>(this->getChild());
733 
734  const CEvaluationNode* pChild2 = dynamic_cast<const CEvaluationNode*>(right.getChild());
735 
736  while (result == false)
737  {
738  if (pChild1 == NULL || pChild2 == NULL)
739  {
740  if (pChild1 == NULL && pChild2 != NULL)
741  {
742  result = true;
743  }
744  }
745  else
746  {
747  result = (*pChild1 < *pChild2);
748  }
749 
750  pChild1 = dynamic_cast<const CEvaluationNode*>(pChild1->getSibling());
751  pChild2 = dynamic_cast<const CEvaluationNode*>(pChild2->getSibling());
752  }
753  }
754 
755  return result;
756 }
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
const Type & getType() const
static Type type(const Type &type)
virtual const Data & getData() const
Definition: CCopasiNode.h:118
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
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

Definition at line 375 of file CEvaluationNode.cpp.

References CEvaluationNode::CPrecedence::left, mPrecedence, and CEvaluationNode::CPrecedence::right.

376 {return (mPrecedence.right < rhs.mPrecedence.left);}
class CEvaluationNode::CPrecedence mPrecedence
bool CEvaluationNode::operator== ( const CEvaluationNode right) const

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

Definition at line 671 of file CEvaluationNode.cpp.

References CNodeContextIterator< Node, int >::end(), CCopasiNode< _Data >::getData(), getType(), and CNodeContextIterator< Node, int >::next().

672 {
675 
676  while (itLeft.next() != itLeft.end() &&
677  itRight.next() != itRight.end())
678  {
679  if (*itLeft == NULL && *itRight == NULL)
680  {
681  continue;
682  }
683 
684  if (*itLeft == NULL || *itRight == NULL)
685  {
686  return false;
687  }
688 
689  if (itLeft->getType() != itRight->getType() ||
690  itLeft->getData() != itRight->getData())
691  {
692  return false;
693  }
694  }
695 
696  return true;
697 }
void CEvaluationNode::printRecursively ( std::ostream &  os,
int  indent = 0 
) const

Definition at line 477 of file CEvaluationNode.cpp.

References CCopasiNode< std::string >::getChild(), CCopasiNode< _Data >::getSibling(), CCopasiNode< std::string >::mData, mType, mValue, printRecursively(), subType(), and type().

Referenced by stress_test::normalizeFunctionDB().

478 {
479  int i;
480 
481  os << std::endl;
482 
483  for (i = 0; i < indent; ++i) os << " ";
484 
485  os << "mData: " << mData << std::endl;
486 
487  for (i = 0; i < indent; ++i) os << " ";
488 
489  os << "mType: " << type(mType) << " subType: " << subType(mType) << std::endl;
490 
491  for (i = 0; i < indent; ++i) os << " ";
492 
493  os << "mValue: " << mValue << std::endl;
494 
495  CEvaluationNode* tmp;
496 
497  tmp = (CEvaluationNode*)getChild();
498 
499  while (tmp)
500  {
501  tmp -> printRecursively(os, indent + 2);
502  tmp = (CEvaluationNode*)tmp->getSibling();
503  }
504 }
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
static Type type(const Type &type)
void printRecursively() const
static Type subType(const Type &type)
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
void CEvaluationNode::printRecursively ( ) const

Definition at line 506 of file CEvaluationNode.cpp.

Referenced by printRecursively().

507 {
508  this->printRecursively(std::cout, 0);
509 }
void printRecursively() const
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.

Definition at line 430 of file CEvaluationNode.cpp.

References copyNode().

Referenced by CEvaluationNodeOperator::simplifyNode(), and CNormalTranslation::simplifyTree().

431 {
432  CEvaluationNode *newnode = copyNode(children);
433  return newnode;
434 }
CEvaluationNode * copyNode(CEvaluationNode *child1, CEvaluationNode *child2) const
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.

Definition at line 511 of file CEvaluationNode.cpp.

References copyBranch(), copyNode(), CCopasiNode< std::string >::getChild(), CCopasiNode< _Data >::getSibling(), and splitBranch().

Referenced by splitBranch(), and CFunction::splitFunction().

512 {
513  if (splitnode == this)
514  {
515  const CEvaluationNode *child = dynamic_cast<const CEvaluationNode*>(this->getChild());
516 
517  if (!child) return NULL;
518 
519  if (left)
520  {
521  return child->copyBranch();
522  }
523  else
524  {
525  child = dynamic_cast<const CEvaluationNode*>(child->getSibling());
526 
527  if (!child) return NULL;
528 
529  return child->copyBranch();
530  }
531  }
532  else
533  {
534  /* const CEvaluationNode *child1 = dynamic_cast<const CEvaluationNode*>(getChild());
535  CEvaluationNode *newchild1 = NULL;
536  CEvaluationNode *newchild2 = NULL;
537  if (child1 != NULL)
538  {
539  newchild1 = child1->splitBranch(splitnode, left);
540  const CEvaluationNode *child2 = dynamic_cast<const CEvaluationNode*>(child1->getSibling());
541  if (child2 != NULL)
542  {
543  newchild2 = child2->splitBranch(splitnode, left);
544  }
545  }
546  CEvaluationNode *newnode = copyNode(newchild1, newchild2);
547  return newnode;*/
548 
549  std::vector<CEvaluationNode*> children;
550  const CEvaluationNode* child = dynamic_cast<const CEvaluationNode*>(getChild());
551 
552  while (child != NULL)
553  {
554  CEvaluationNode *newchild = NULL;
555  newchild = child->splitBranch(splitnode, left);
556  children.push_back(newchild);
557  child = dynamic_cast<const CEvaluationNode*>(child->getSibling());
558  }
559 
560  children.push_back(NULL);
561  CEvaluationNode *newnode = copyNode(children);
562  return newnode;
563  }
564 }
CEvaluationNode * copyBranch() const
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
CEvaluationNode * copyNode(CEvaluationNode *child1, CEvaluationNode *child2) const
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
CEvaluationNode * splitBranch(const CEvaluationNode *splitnode, bool left) const
CEvaluationNode::Type CEvaluationNode::subType ( const Type type)
static

Retrieve the subtype part of type

Parameters
constType & type
Returns
Type subType

Definition at line 120 of file CEvaluationNode.cpp.

Referenced by CSBMLExporter::checkForUnsupportedFunctionCalls(), CEvaluationNodeObject::compile(), CMathTrigger::compile(), CMathEventN::CTrigger::compileAND(), CMathEventN::CTrigger::compileLE(), CMathEventN::CTrigger::countRoots(), create(), createCall(), createFunction(), createGeneralPower(), createItemPower(), createItemPowerItem(), createLogical(), createLogicalItem(), CEvaluationNodeOperator::createModuloTree(), createProduct(), createSum(), CDerive::deriveBranch(), SBMLImporter::divideByObject(), CNormalTranslation::elementaryElimination(), CNormalTranslation::elementaryEliminationDivide(), CNormalTranslation::elementaryEliminationFunction(), CNormalTranslation::elementaryEliminationMinus(), CNormalTranslation::elementaryEliminationModulus(), CNormalTranslation::elementaryEliminationMultiply(), CNormalTranslation::elementaryEliminationPlus(), CNormalTranslation::elementaryEliminationPower(), CNormalTranslation::eliminateDirectlyNestedFractions(), CNormalTranslation::eliminateNestedPowers(), CNormalTranslation::eliminatePowersOfFractions(), CFunctionAnalyzer::evaluateNode(), CNormalTranslation::expandPowerBases(), CNormalTranslation::expandPowerExponents(), CNormalTranslation::expandPowerNodes(), CNormalTranslation::expandProducts(), CNormalTranslation::factorize(), CEvaluationNodeNormalizer::findChainNodes(), CNormalTranslation::findNegativeNumbers(), CNormalTranslation::findSummands(), CEvaluationNodeNumber::fromAST(), CEvaluationNodeDelay::fromAST(), CEvaluationNodeConstant::fromAST(), CEvaluationNodeChoice::fromAST(), CEvaluationNodeCall::fromAST(), CEvaluationNodeOperator::fromAST(), CEvaluationNodeLogical::fromAST(), CEvaluationNodeFunction::fromAST(), CEvaluationNodeConstant::getBerkeleyMadonnaString(), CEvaluationNodeLogical::getBerkeleyMadonnaString(), CEvaluationNodeFunction::getBerkeleyMadonnaString(), CEvaluationNodeConstant::getCCodeString(), CEvaluationNodeOperator::getCCodeString(), CEvaluationNodeLogical::getCCodeString(), CEvaluationNodeFunction::getCCodeString(), CEvaluationNodeObject::getData(), CEvaluationNodeObject::getInfix(), CEvaluationNodeConstant::getMMLString(), CEvaluationNodeLogical::getMMLString(), CEvaluationNodeConstant::getXPPString(), CEvaluationNodeOperator::getXPPString(), CEvaluationNodeLogical::getXPPString(), CEvaluationNodeFunction::getXPPString(), CEvaluationNodeConstant::isBoolean(), CEvaluationNodeFunction::isBoolean(), isLogical(), SBMLImporter::isMassActionExpression(), CNormalTranslation::matchPowerBases(), CNormalTranslation::matchSummands(), CSBMLExporter::multiplyByObject(), CNormalTranslation::newCancel(), CNormalTranslation::newEvaluateNumbers(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeCall(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeDelay(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeFunction(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeLogical(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeOperator(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeVector(), CEvaluationNodeNormalizer::normalizeModulusNode(), CEvaluationNodeNormalizer::normalizeMultiplyNode(), CEvaluationNodeNormalizer::normalizePlusNode(), printRecursively(), CNormalTranslation::product2fraction(), CSBMLExporter::replaceSpeciesReferences(), SBMLImporter::separateProductArguments(), CEvaluationNodeObject::setData(), CFunction::setInfix(), CEvaluationNodeObject::setObjectValuePtr(), CEvaluationNodeOperator::simplifyNode(), CEvaluationNodeFunction::simplifyNode(), CNormalTranslation::splitProduct(), CNormalTranslation::splitSum(), CNormalTranslation::swapNegativeNumbers(), test000053::test1_bug1000(), test000053::test2_bug1000(), test000053::test3_bug1000(), test000053::test4_bug1000(), test000053::test5_bug1000(), test000093::test_bug1503_1(), test000093::test_bug1503_2(), test000052::test_bug988(), test_compare_utilities::test_copasi_function_expansion(), test000047::test_delay(), test000091::test_delay_in_kinetic_law(), test000091::test_delay_in_kinetic_law_local_parameter(), test_depth_first_iterator::test_dfi(), test000023::test_hasOnlySubstanceUnits(), test000025::test_hasOnlySubstanceUnits(), test000033::test_hasOnlySubstanceUnits(), test000042::test_hasOnlySubstanceUnits(), test000040::test_hasOnlySubstanceUnits(), test000043::test_hasOnlySubstanceUnits(), test000026::test_hasOnlySubstanceUnits(), test000082::test_import_delayAssignment_1(), test000082::test_import_delayAssignment_2(), test000082::test_import_delayAssignment_3(), test000082::test_import_delayAssignment_4(), test000082::test_import_delayAssignment_5(), test000082::test_import_delayAssignment_6(), test000082::test_import_delayAssignment_7(), test000082::test_import_delayAssignment_8(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_1(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_2(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_3(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_4(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_5(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_6(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_7(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_8(), test000095::test_import_l3_event_1(), test000095::test_import_l3_event_2(), test000095::test_import_l3_event_3(), test000095::test_import_l3_event_4(), test000095::test_import_l3_event_5(), test000065::test_import_reaction_with_unsuitable_kinetic_1(), test000065::test_import_reaction_with_unsuitable_kinetic_2(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_1(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_4(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_6(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_7(), test000075::test_import_time_dependent_function_definition(), test000078::test_l2v4_import_unordered_functions(), CEvaluationNodeNumber::toAST(), CEvaluationNodeConstant::toAST(), CEvaluationNodeOperator::toAST(), CEvaluationNodeLogical::toAST(), CEvaluationNodeFunction::toAST(), and CReaction::variables2objects().

121 {return (Type)(type & 0x00FFFFFF);}
static Type type(const Type &type)
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

Definition at line 123 of file CEvaluationNode.cpp.

Referenced by CODEExporter::assembleSubTreeForMassAction(), CEvaluationTree::buildCalculationSequence(), CEvaluationNodeCall::buildParameters(), CSBMLExporter::checkForPiecewiseFunctions(), CSBMLExporter::checkForUnsupportedFunctionCalls(), CSBMLExporter::checkForUnsupportedObjectReferences(), CEvaluationNodeCall::clearParameters(), CMathEventN::CTrigger::compile(), CMathTrigger::compile(), CMathTrigger::compileEQ(), CModelAdd::copyDelayExpression(), CModelAdd::copyEventAssignmentExpression(), CModelAdd::copyExpression(), CModelAdd::copyInitialExpression(), CModelAdd::copyTriggerExpression(), CMathEventN::CTrigger::countRoots(), create(), createCall(), createChoice(), SBMLImporter::createCReactionFromReaction(), CSBMLExporter::createEvent(), createFunction(), createGeneralPower(), CSBMLExporter::createInitialAssignment(), createItem(), createItemPower(), createItemPowerItem(), createLogical(), createLogicalChoice(), createLogicalItem(), createNormalRepresentation(), createProduct(), CSBMLExporter::createRule(), createSum(), SBMLImporter::divideByObject(), CNormalTranslation::elementaryElimination(), CNormalTranslation::elementaryEliminationDivide(), CNormalTranslation::elementaryEliminationFunction(), CNormalTranslation::elementaryEliminationMinus(), CNormalTranslation::elementaryEliminationModulus(), CNormalTranslation::elementaryEliminationMultiply(), CNormalTranslation::elementaryEliminationPlus(), CNormalTranslation::elementaryEliminationPower(), CNormalTranslation::eliminateDirectlyNestedFractions(), CNormalTranslation::eliminateNestedPowers(), CNormalTranslation::eliminatePowersOfFractions(), CFunctionAnalyzer::evaluateNode(), CNormalTranslation::expandPowerBases(), CNormalTranslation::expandPowerExponents(), CNormalTranslation::expandPowerNodes(), CNormalTranslation::expandProducts(), CSBMLExporter::exportEventAssignments(), CODEExporter::exportExpression(), CODEExporter::exportKineticFunction(), CODEExporterC::exportSingleFunction(), CODEExporter::exportSingleFunction(), CNormalTranslation::factorize(), CEvaluationNodeNormalizer::findChainNodes(), CSBMLExporter::findDirectlyUsedFunctions(), SBMLImporter::findFunctionCalls(), CODEExporter::findFunctionsCalls(), CSBMLExporter::findModelEntityDependencies(), CNormalTranslation::findNegativeNumbers(), CNormalTranslation::findSummands(), CEvaluationNodeOperator::fromAST(), CEvaluationNodeFunction::fromAST(), CEvaluationNodeFunction::getMMLString(), CFunction::initVariables(), SBMLImporter::isConstantFlux(), CSBMLExporter::isEventAssignmentSBMLCompatible(), isLogical(), SBMLImporter::isMassActionExpression(), CODEExporter::isModelEntityExpressionODEExporterCompatible(), CNormalTranslation::matchPowerBases(), CNormalTranslation::matchSummands(), CModelMerging::mergeInExpression(), CODEExporter::modifyTreeForMassAction(), CNormalTranslation::multiply(), CSBMLExporter::multiplyByObject(), CNormalTranslation::newCancel(), CNormalTranslation::newEvaluateNumbers(), CEvaluationNodeNormalizer::normalize(), CEvaluationNodeNormalizer::normalizeCEvaluationNodeChoice(), CEvaluationNodeNormalizer::normalizeDivideNode(), CEvaluationNodeNormalizer::normalizeMinusNode(), CEvaluationNodeNormalizer::normalizeModulusNode(), CEvaluationNodeNormalizer::normalizeMultiplyNode(), CEvaluationNodeNormalizer::normalizePlusNode(), CEvaluationNodeNormalizer::normalizePowerNode(), CReaction::objects2variables(), operator<(), printRecursively(), CNormalTranslation::product2fraction(), CSBMLExporter::replaceSpeciesReferences(), setBooleanRequired(), CODEExporterC::setExportNameOfFunction(), CSBMLExporter::setFunctionSBMLIds(), CFunction::setInfix(), CEvaluationNodeOperator::simplifyNode(), CEvaluationNodeFunction::simplifyNode(), CNormalTranslation::splitProduct(), CNormalTranslation::splitSum(), CNormalTranslation::swapNegativeNumbers(), test000053::test1_bug1000(), test000053::test2_bug1000(), test000053::test3_bug1000(), test000053::test4_bug1000(), test000053::test5_bug1000(), test000093::test_bug1503_1(), test000093::test_bug1503_2(), test000061::test_bug_1044(), test_compare_utilities::test_copasi_function_expansion(), test000091::test_delay_in_kinetic_law(), test000091::test_delay_in_kinetic_law_local_parameter(), test_depth_first_iterator::test_dfi(), test000082::test_import_delayAssignment_1(), test000082::test_import_delayAssignment_2(), test000082::test_import_delayAssignment_3(), test000082::test_import_delayAssignment_4(), test000082::test_import_delayAssignment_5(), test000082::test_import_delayAssignment_6(), test000082::test_import_delayAssignment_7(), test000082::test_import_delayAssignment_8(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_1(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_2(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_3(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_4(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_5(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_6(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_7(), test000064::test_import_event_assignment_expression_and_hasOnlySubstanceUnits_8(), test000095::test_import_l3_event_1(), test000095::test_import_l3_event_2(), test000095::test_import_l3_event_3(), test000095::test_import_l3_event_4(), test000095::test_import_l3_event_5(), test000087::test_import_reaction_flux_reference_2(), test000065::test_import_reaction_with_unsuitable_kinetic_1(), test000065::test_import_reaction_with_unsuitable_kinetic_2(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_1(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_2(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_3(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_4(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_5(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_6(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_7(), test000064::test_import_rule_expression_and_hasOnlySubstanceUnits_8(), test000075::test_import_time_dependent_function_definition(), test000078::test_l2v4_import_unordered_functions(), test000087::test_simulate_reaction_flux_reference_1(), CReaction::variables2objects(), and CEvaluationNodeCall::verifyParameters().

124 {return (Type)(type & 0xFF000000);}
static Type type(const Type &type)

Member Data Documentation

const char * CEvaluationNode::Keywords
staticprivate

A list of reserved key words

Definition at line 86 of file CEvaluationNode.h.

Referenced by isKeyword().

class CEvaluationNode::CPrecedence CEvaluationNode::mPrecedence
protected
const C_FLOAT64* CEvaluationNode::mpValue
protected
Type CEvaluationNode::mType
protected
C_FLOAT64 CEvaluationNode::mValue
protected

The documentation for this class was generated from the following files: