20 #include "sbml/math/ASTNode.h"
74 if (
mpIf == NULL)
return false;
78 if (
mpTrue == NULL)
return false;
82 if (
mpFalse == NULL)
return false;
90 if (const_cast<CEvaluationNodeChoice *>(
this)->
compile(NULL))
91 return mData +
"(" + children[0] +
"," + children[1] +
"," + children[2] +
")";
99 if (const_cast<CEvaluationNodeChoice *>(
this)->
compile(NULL))
100 return mData +
"(" + children[0] +
"," + children[1] +
"," + children[2] +
")";
108 if (const_cast<CEvaluationNodeChoice *>(
this)->
compile(NULL))
109 return "(" + children[0] +
" ? " + children[1] +
" : " + children[2] +
")";
117 if (const_cast<CEvaluationNodeChoice *>(
this)->
compile(NULL))
118 return "(if " + children[0] +
" then " + children[1] +
" else " + children[2] +
")";
126 if (const_cast<CEvaluationNodeChoice *>(
this)->
compile(NULL))
127 return "if(" + children[0] +
")then(" + children[1] +
")else(" + children[2] +
")";
135 assert(pASTNode->getNumChildren() == children.size());
137 size_t i = 0, iMax = children.size();
157 std::string data =
"";
159 switch (pASTNode->getType())
161 case AST_FUNCTION_PIECEWISE:
178 pCurrent->
addChild(children[i + 1]);
213 ASTNode* node =
new ASTNode(AST_FUNCTION_PIECEWISE);
215 assert(child1 != NULL);
217 assert(child2 != NULL);
219 assert(child3 != NULL);
222 node->addChild(child2->
toAST(pDataModel));
223 node->addChild(child1->
toAST(pDataModel));
224 node->addChild(child3->
toAST(pDataModel));
233 const std::vector< std::vector< std::string > > & )
const
235 std::ostringstream out;
237 if (const_cast<CEvaluationNodeChoice *>(
this)->
compile(NULL))
239 out <<
"<mrow>" << std::endl;
240 out <<
"<mo> {</mo>" << std::endl;
241 out <<
"<mtable>" << std::endl;
243 out <<
"<mtr>" << std::endl;
245 out <<
"<mtd>" << std::endl;
247 out <<
"<mo> , </mo>" << std::endl;
248 out <<
"</mtd>" << std::endl;
250 out <<
"<mtd>" << std::endl;
253 out <<
"</mtd>" << std::endl;
255 out <<
"</mtr>" << std::endl;
257 out <<
"<mtr>" << std::endl;
259 out <<
"<mtd>" << std::endl;
260 out <<
"<mo> else, </mo>" << std::endl;
262 out <<
"</mtd>" << std::endl;
263 out <<
"<mtd>" << std::endl;
265 out <<
"</mtd>" << std::endl;
267 out <<
"</mtr>" << std::endl;
269 out <<
"</mtable>" << std::endl;
270 out <<
"</mrow>" << std::endl;
virtual ASTNode * toAST(const CCopasiDataModel *pDataModel) const
virtual bool compile(const CEvaluationTree *pTree)
virtual std::string getInfix(const std::vector< std::string > &children) const
CCopasiNode< Data > * getSibling()
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
const C_FLOAT64 & getValue() 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
virtual std::string getBerkeleyMadonnaString(const std::vector< std::string > &children) const
virtual ~CEvaluationNodeChoice()
#define PRECEDENCE_FUNCTION
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
virtual std::string getDisplayString(const std::vector< std::string > &children) const
virtual ASTNode * toAST(const CCopasiDataModel *pDataModel) const
static Type subType(const Type &type)
virtual std::string getCCodeString(const std::vector< std::string > &children) const
class CEvaluationNode::CPrecedence mPrecedence
#define PRECEDENCE_NUMBER
CCopasiNode< Data > * getChild()
CEvaluationNode * mpFalse