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

#include <CEvaluationNodeDelay.h>

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

Public Types

enum  SubType { INVALID = 0x00FFFFFF, DELAY = 0x00000000 }
 
- Public Types inherited from CEvaluationNode
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

 CEvaluationNodeDelay (const SubType &subType, const Data &data)
 
 CEvaluationNodeDelay (const CEvaluationNodeDelay &src)
 
virtual bool compile (const CEvaluationTree *pTree)
 
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
 
virtual std::string getXPPString (const std::vector< std::string > &children) const
 
ASTNode * toAST (const CCopasiDataModel *pDataModel) const
 
virtual ~CEvaluationNodeDelay ()
 
- Public Member Functions inherited from CEvaluationNode
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)
 
CEvaluationNodecopyBranch () const
 
CEvaluationNodecopyNode (CEvaluationNode *child1, CEvaluationNode *child2) const
 
CEvaluationNodecopyNode (const std::vector< CEvaluationNode * > &children) const
 
const CEvaluationNodefindTopMinus (const std::vector< CFunctionAnalyzer::CValue > &callParameters) const
 
const TypegetType () const
 
const C_FLOAT64getValue () const
 
const C_FLOAT64getValuePointer () 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 ~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 CEvaluationNodefromAST (const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
 
- Static Public Member Functions inherited from CEvaluationNode
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)
 

Private Member Functions

 CEvaluationNodeDelay ()
 

Private Attributes

CEvaluationNodempDelayedObject
 
CEvaluationNodempDeltaT
 

Additional Inherited Members

- Protected Member Functions inherited from CEvaluationNode
 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 inherited from CEvaluationNode
class CEvaluationNode::CPrecedence mPrecedence
 
const C_FLOAT64mpValue
 
Type mType
 
C_FLOAT64 mValue
 
- Protected Attributes inherited from CCopasiNode< std::string >
Data mData
 

Detailed Description

This is class for nodes representing the (SBML) delay function.

Definition at line 28 of file CEvaluationNodeDelay.h.

Member Enumeration Documentation

Enumeration of possible node types.

Enumerator
INVALID 
DELAY 

Definition at line 34 of file CEvaluationNodeDelay.h.

35  {
36  INVALID = 0x00FFFFFF,
37  DELAY = 0x00000000
38  };

Constructor & Destructor Documentation

CEvaluationNodeDelay::CEvaluationNodeDelay ( )
private

Default constructor

Definition at line 24 of file CEvaluationNodeDelay.cpp.

References CEvaluationNode::mPrecedence, and PRECEDENCE_NUMBER.

Referenced by fromAST().

24  :
26  mpDelayedObject(NULL),
27  mpDeltaT(NULL)
CEvaluationNode * mpDeltaT
class CEvaluationNode::CPrecedence mPrecedence
#define PRECEDENCE_NUMBER
CEvaluationNode * mpDelayedObject
CEvaluationNodeDelay::CEvaluationNodeDelay ( const SubType subType,
const Data data 
)

constructor

Parameters
constSubType & subType
constData & data

Definition at line 30 of file CEvaluationNodeDelay.cpp.

References DELAY, fatalError, CEvaluationNode::mPrecedence, CEvaluationNode::mValue, and PRECEDENCE_FUNCTION.

31  :
33  mpDelayedObject(NULL),
34  mpDeltaT(NULL)
35 {
36  switch (subType)
37  {
38  case DELAY:
39  mValue = std::numeric_limits<C_FLOAT64>::quiet_NaN();
40  break;
41 
42  default:
43  fatalError();
44  break;
45  }
46 
48 }
#define fatalError()
CEvaluationNode * mpDeltaT
#define PRECEDENCE_FUNCTION
static Type subType(const Type &type)
class CEvaluationNode::CPrecedence mPrecedence
CEvaluationNode * mpDelayedObject
CEvaluationNodeDelay::CEvaluationNodeDelay ( const CEvaluationNodeDelay src)

Copy constructor

Parameters
constCEvaluationNodeDelay & src

Definition at line 50 of file CEvaluationNodeDelay.cpp.

50  :
51  CEvaluationNode(src),
52  mpDelayedObject(NULL),
53  mpDeltaT(NULL)
54 {}
CEvaluationNode * mpDeltaT
CEvaluationNode * mpDelayedObject
CEvaluationNodeDelay::~CEvaluationNodeDelay ( )
virtual

Destructor

Definition at line 56 of file CEvaluationNodeDelay.cpp.

56 {}

Member Function Documentation

bool CEvaluationNodeDelay::compile ( const CEvaluationTree pTree)
virtual

Compile a node;

Parameters
constCEvaluationTree * pTree
Returns
bool success;

Reimplemented from CEvaluationNode.

Definition at line 58 of file CEvaluationNodeDelay.cpp.

References DELAY, CCopasiNode< std::string >::getChild(), CCopasiNode< _Data >::getSibling(), mpDelayedObject, mpDeltaT, and CEvaluationNode::mType.

Referenced by getInfix().

59 {
60  bool success = true;
61 
62  switch (mType & 0x00FFFFFF)
63  {
64  case DELAY:
65  mpDelayedObject = static_cast<CEvaluationNode *>(getChild());
66 
67  if (mpDelayedObject == NULL) return false;
68 
70 
71  if (mpDeltaT == NULL) return false;
72 
73  return (mpDeltaT->getSibling() == NULL); // We must have exactly 2 children
74 
75  break;
76 
77  default:
78  success = false;
79  break;
80  }
81 
82  return success;
83 }
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
CEvaluationNode * mpDeltaT
CEvaluationNode * mpDelayedObject
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
CEvaluationNode * CEvaluationNodeDelay::fromAST ( const ASTNode *  pASTNode,
const std::vector< CEvaluationNode * > &  children 
)
static

Creates a new CEvaluationNodeCall from an ASTNode and the given children

Parameters
constASTNode* pNode
conststd::vector< CEvaluationNode * > & children
Returns
CEvaluationNode * pCretedNode

Definition at line 169 of file CEvaluationNodeDelay.cpp.

References CCopasiNode< _Data >::addChild(), CEvaluationNodeDelay(), CEvaluationNode::compile(), DELAY, and CEvaluationNode::subType().

Referenced by CEvaluationTree::fromAST().

170 {
171  assert(pASTNode->getNumChildren() == children.size());
172 
173  size_t i = 0, iMax = children.size();
174 
176  std::string data = "delay";
177 
178  CEvaluationNode * pConvertedNode = new CEvaluationNodeDelay(subType, data);
179 
180  for (i = 0; i < iMax; ++i)
181  {
182  pConvertedNode->addChild(children[i]);
183  }
184 
185  pConvertedNode->compile(NULL);
186  return pConvertedNode;
187 }
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
Definition: CCopasiNode.h:156
static Type subType(const Type &type)
virtual bool compile(const CEvaluationTree *pTree)
std::string CEvaluationNodeDelay::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
const Data & value

Reimplemented from CEvaluationNode.

Definition at line 137 of file CEvaluationNodeDelay.cpp.

References DELAY, CCopasiNode< std::string >::mData, and CEvaluationNode::mType.

138 {
139  switch (mType & 0x00FFFFFF)
140  {
141  case DELAY:
142  return mData + "(" + children[0] + "," + children[1] + ")";
143  break;
144 
145  default:
146  break;
147  }
148 
149  return "@";
150 }
std::string CEvaluationNodeDelay::getCCodeString ( const std::vector< std::string > &  children) const
virtual

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

Returns
const Data & value

Reimplemented from CEvaluationNode.

Definition at line 121 of file CEvaluationNodeDelay.cpp.

References DELAY, CCopasiNode< std::string >::mData, and CEvaluationNode::mType.

122 {
123  switch (mType & 0x00FFFFFF)
124  {
125  case DELAY:
126  return mData + "(" + children[0] + "," + children[1] + ")";
127  break;
128 
129  default:
130  break;
131  }
132 
133  return "@";
134 }
std::string CEvaluationNodeDelay::getDisplayString ( const std::vector< std::string > &  children) const
virtual

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

Returns
const Data & value

Reimplemented from CEvaluationNode.

Definition at line 105 of file CEvaluationNodeDelay.cpp.

References DELAY, CCopasiNode< std::string >::mData, and CEvaluationNode::mType.

106 {
107  switch (mType & 0x00FFFFFF)
108  {
109  case DELAY:
110  return mData + "(" + children[0] + "," + children[1] + ")";
111  break;
112 
113  default:
114  break;
115  }
116 
117  return "@";
118 }
std::string CEvaluationNodeDelay::getInfix ( const std::vector< std::string > &  children) const
virtual

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

Returns
const Data & value

Reimplemented from CEvaluationNode.

Definition at line 86 of file CEvaluationNodeDelay.cpp.

References compile(), DELAY, CCopasiNode< std::string >::mData, and CEvaluationNode::mType.

87 {
88  if (const_cast<CEvaluationNodeDelay*>(this)->compile(NULL))
89  {
90  switch (mType & 0x00FFFFFF)
91  {
92  case DELAY:
93  return mData + "(" + children[0] + "," + children[1] + ")";
94  break;
95 
96  default:
97  break;
98  }
99  }
100 
101  return "@";
102 }
virtual bool compile(const CEvaluationTree *pTree)
std::string CEvaluationNodeDelay::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 from CEvaluationNode.

Definition at line 206 of file CEvaluationNodeDelay.cpp.

References DELAY, CCopasiNode< std::string >::mData, and CEvaluationNode::mType.

209 {
210  std::ostringstream out;
211 
212  switch (mType & 0x00FFFFFF)
213  {
214  case DELAY:
215  out << "<mrow>" << std::endl;
216 
217  out << "<mi>" << mData << "</mi>" << std::endl;
218  out << "<mrow>" << std::endl;
219  out << "<mo> (</mo>" << std::endl;
220  out << "<mrow>" << std::endl;
221 
222  out << children[0];
223 
224  out << "<mo> , </mo>" << std::endl;
225 
226  out << children[1];
227 
228  out << "</mrow>" << std::endl;
229  out << "<mo>) </mo>" << std::endl;
230 
231  out << "</mrow>" << std::endl;
232  out << "</mrow>" << std::endl;
233  break;
234 
235  default:
236  break;
237  }
238 
239  return out.str();
240 }
std::string CEvaluationNodeDelay::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
const Data & value

Reimplemented from CEvaluationNode.

Definition at line 153 of file CEvaluationNodeDelay.cpp.

References DELAY, CCopasiNode< std::string >::mData, and CEvaluationNode::mType.

154 {
155  switch (mType & 0x00FFFFFF)
156  {
157  case DELAY:
158  return mData + "(" + children[0] + "," + children[1] + ")";
159  break;
160 
161  default:
162  break;
163  }
164 
165  return "@";
166 }
ASTNode * CEvaluationNodeDelay::toAST ( const CCopasiDataModel pDataModel) const
virtual

Create a new ASTNode corresponding to this delay node.

Returns
ASTNode* return a pointer to the newly created node;

Reimplemented from CEvaluationNode.

Definition at line 189 of file CEvaluationNodeDelay.cpp.

References CCopasiNode< _Data >::addChild(), CCopasiNode< std::string >::getChild(), CCopasiNode< _Data >::getSibling(), and CEvaluationNode::toAST().

190 {
191  ASTNode* pNode = new ASTNode(AST_FUNCTION_DELAY);
192  const CEvaluationNode* child = static_cast<const CEvaluationNode*>(this->getChild());
193 
194  while (child)
195  {
196  pNode->addChild(child->toAST(pDataModel));
197  child = static_cast<const CEvaluationNode*>(child->getSibling());
198  }
199 
200  return pNode;
201 }
virtual ASTNode * toAST(const CCopasiDataModel *pDataModel) const
CCopasiNode< Data > * getSibling()
Definition: CCopasiNode.h:353
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
Definition: CCopasiNode.h:156
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210

Member Data Documentation

CEvaluationNode* CEvaluationNodeDelay::mpDelayedObject
private

Definition at line 132 of file CEvaluationNodeDelay.h.

Referenced by compile().

CEvaluationNode* CEvaluationNodeDelay::mpDeltaT
private

Definition at line 133 of file CEvaluationNodeDelay.h.

Referenced by compile().


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