19 #include "sbml/math/ASTNode.h"
33 switch (
mType & 0x00FFFFFF)
85 if (
mpLeft == NULL)
return false;
89 if (
mpRight == NULL)
return false;
97 if (const_cast<CEvaluationNodeLogical *>(
this)->
compile(NULL))
102 Infix =
"(" + children[0] +
")";
106 Infix +=
" " +
mData +
" ";
109 Infix +=
"(" + children[1] +
")";
111 Infix += children[1];
122 if (const_cast<CEvaluationNodeLogical *>(
this)->
compile(NULL))
127 DisplayString =
"(" + children[0] +
")";
129 DisplayString = children[0] +
" ";
131 DisplayString +=
mData;
134 DisplayString +=
"(" + children[1] +
")";
136 DisplayString +=
" " + children[1];
138 return DisplayString;
147 if (const_cast<CEvaluationNodeLogical *>(
this)->
compile(NULL))
197 DisplayString =
" !";
202 DisplayString +=
"(" + children[0] +
")";
204 DisplayString += children[0] +
" ";
206 DisplayString += data;
209 DisplayString +=
" !";
212 DisplayString +=
"(" + children[1] +
")";
214 DisplayString +=
" " + children[1];
216 return DisplayString;
225 if (const_cast<CEvaluationNodeLogical *>(
this)->
compile(NULL))
272 DisplayString =
"(" + children[0] +
")";
274 DisplayString = children[0] +
" ";
276 DisplayString += data;
279 DisplayString +=
"(" + children[1] +
")";
281 DisplayString +=
" " + children[1];
283 return DisplayString;
292 if (const_cast<CEvaluationNodeLogical *>(
this)->
compile(NULL))
339 DisplayString =
"(" + children[0] +
")";
341 DisplayString = children[0] +
" ";
343 DisplayString += data;
346 DisplayString +=
"(" + children[1] +
")";
348 DisplayString +=
" " + children[1];
350 return DisplayString;
359 assert(pASTNode->getNumChildren() == children.size());
362 size_t iMax = children.size();
365 std::string data =
"";
367 switch (pASTNode->getType())
369 case AST_LOGICAL_AND:
379 case AST_LOGICAL_XOR:
384 case AST_RELATIONAL_EQ:
389 case AST_RELATIONAL_GEQ:
394 case AST_RELATIONAL_GT:
399 case AST_RELATIONAL_LEQ:
404 case AST_RELATIONAL_LT:
409 case AST_RELATIONAL_NEQ:
507 ASTNode* node =
new ASTNode();
512 node->setType(AST_LOGICAL_AND);
516 node->setType(AST_LOGICAL_OR);
520 node->setType(AST_LOGICAL_XOR);
524 node->setType(AST_RELATIONAL_EQ);
528 node->setType(AST_RELATIONAL_NEQ);
532 node->setType(AST_RELATIONAL_GT);
536 node->setType(AST_RELATIONAL_GEQ);
540 node->setType(AST_RELATIONAL_LT);
544 node->setType(AST_RELATIONAL_LEQ);
560 node->addChild(child2->
toAST(pDataModel));
571 const std::vector< std::vector< std::string > > & )
const
573 std::ostringstream out;
575 if (const_cast<CEvaluationNodeLogical *>(
this)->
compile(NULL))
577 std::string data =
"";
626 out <<
"<mrow>" << std::endl;
630 if (flag) out <<
"<mfenced>" << std::endl;
634 if (flag) out <<
"</mfenced>" << std::endl;
636 out <<
"<mo>" << data <<
"</mo>" << std::endl;
640 if (!flag) out <<
"<mfenced>" << std::endl;
644 if (!flag) out <<
"</mfenced>" << std::endl;
646 out <<
"</mrow>" << std::endl;
#define PRECEDENCE_LOGIG_AND
#define PRECEDENCE_LOGIG_XOR
virtual ASTNode * toAST(const CCopasiDataModel *pDataModel) const
#define PRECEDENCE_LOGIG_OR
virtual std::string getXPPString(const std::vector< std::string > &children) const
CCopasiNode< Data > * getSibling()
#define PRECEDENCE_LOGIG_LE
#define PRECEDENCE_LOGIG_NE
#define PRECEDENCE_LOGIG_LT
virtual std::string getBerkeleyMadonnaString(const std::vector< std::string > &children) const
const Type & getType() const
static CEvaluationNode * fromAST(const ASTNode *pASTNode, const std::vector< CEvaluationNode * > &children)
virtual std::string getDisplayString(const std::vector< std::string > &children) const
virtual ASTNode * toAST(const CCopasiDataModel *pDataModel) const
virtual std::string getCCodeString(const std::vector< std::string > &children) const
#define PRECEDENCE_LOGIG_EQ
virtual std::string getMMLString(const std::vector< std::string > &children, bool expand, const std::vector< std::vector< std::string > > &variables) const
virtual bool compile(const CEvaluationTree *pTree)
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
virtual bool isBoolean() const
virtual ~CEvaluationNodeLogical()
static Type subType(const Type &type)
class CEvaluationNode::CPrecedence mPrecedence
virtual std::string getInfix(const std::vector< std::string > &children) const
#define PRECEDENCE_LOGIG_GE
CCopasiNode< Data > * getChild()
CEvaluationNode * mpRight
#define PRECEDENCE_LOGIG_GT