www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
ExpressionBuilder::EBTernaryTermNode Class Referenceabstract

Base class for nodes with two sub nodes (i.e. functions or operators taking two arguments) More...

#include <ExpressionBuilder.h>

Inheritance diagram for ExpressionBuilder::EBTernaryTermNode:
[legend]

Public Member Functions

 EBTernaryTermNode (EBTermNode *left, EBTermNode *middle, EBTermNode *right)
 
virtual ~EBTernaryTermNode ()
 
virtual unsigned int substitute (const EBSubstitutionRuleList &rule)
 
virtual EBTermNodeclone () const =0
 
virtual std::string stringify () const =0
 
virtual int precedence () const =0
 

Protected Attributes

EBTermNode_middle
 
EBTermNode_left
 
EBTermNode_right
 

Detailed Description

Base class for nodes with two sub nodes (i.e. functions or operators taking two arguments)

Definition at line 259 of file ExpressionBuilder.h.

Constructor & Destructor Documentation

ExpressionBuilder::EBTernaryTermNode::EBTernaryTermNode ( EBTermNode left,
EBTermNode middle,
EBTermNode right 
)
inline

Definition at line 262 of file ExpressionBuilder.h.

263  : EBBinaryTermNode(left, right), _middle(middle){};
EBBinaryTermNode(EBTermNode *left, EBTermNode *right)
virtual ExpressionBuilder::EBTernaryTermNode::~EBTernaryTermNode ( )
inlinevirtual

Definition at line 264 of file ExpressionBuilder.h.

264 { delete _middle; };

Member Function Documentation

virtual EBTermNode* ExpressionBuilder::EBTermNode::clone ( ) const
pure virtualinherited
virtual int ExpressionBuilder::EBTermNode::precedence ( ) const
pure virtualinherited
virtual std::string ExpressionBuilder::EBTermNode::stringify ( ) const
pure virtualinherited
unsigned int ExpressionBuilder::EBTernaryTermNode::substitute ( const EBSubstitutionRuleList rule)
virtual

Reimplemented from ExpressionBuilder::EBBinaryTermNode.

Definition at line 358 of file ExpressionBuilder.C.

359 {
360  unsigned int nrule = rules.size();
361  bool left_success = false, middle_success = false, right_success = false;
362  EBTermNode * replace;
363 
364  for (unsigned int i = 0; i < nrule; ++i)
365  {
366  replace = rules[i]->apply(_left);
367  if (replace)
368  {
369  delete _left;
370  _left = replace;
371  left_success = true;
372  break;
373  }
374  }
375 
376  for (unsigned int i = 0; i < nrule; ++i)
377  {
378  replace = rules[i]->apply(_middle);
379  if (replace)
380  {
381  delete _middle;
382  _middle = replace;
383  middle_success = true;
384  break;
385  }
386  }
387 
388  for (unsigned int i = 0; i < nrule; ++i)
389  {
390  replace = rules[i]->apply(_right);
391  if (replace)
392  {
393  delete _right;
394  _right = replace;
395  right_success = true;
396  break;
397  }
398  }
399 
400  if (!left_success)
401  left_success = _left->substitute(rules);
402  if (!middle_success)
403  middle_success = _middle->substitute(rules);
404  if (!right_success)
405  right_success = _right->substitute(rules);
406 
407  return left_success + middle_success + right_success;
408 }
virtual unsigned int substitute(const EBSubstitutionRuleList &)

Member Data Documentation

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_left
protectedinherited

Definition at line 196 of file ExpressionBuilder.h.

EBTermNode* ExpressionBuilder::EBTernaryTermNode::_middle
protected

Definition at line 269 of file ExpressionBuilder.h.

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_right
protectedinherited

Definition at line 197 of file ExpressionBuilder.h.


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