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 262 of file ExpressionBuilder.h.

Constructor & Destructor Documentation

◆ EBTernaryTermNode()

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

Definition at line 265 of file ExpressionBuilder.h.

266  : EBBinaryTermNode(left, right), _middle(middle){};
EBBinaryTermNode(EBTermNode *left, EBTermNode *right)

◆ ~EBTernaryTermNode()

virtual ExpressionBuilder::EBTernaryTermNode::~EBTernaryTermNode ( )
inlinevirtual

Definition at line 267 of file ExpressionBuilder.h.

267 { delete _middle; };

Member Function Documentation

◆ clone()

virtual EBTermNode* ExpressionBuilder::EBTermNode::clone ( ) const
pure virtualinherited

◆ precedence()

virtual int ExpressionBuilder::EBTermNode::precedence ( ) const
pure virtualinherited

◆ stringify()

virtual std::string ExpressionBuilder::EBTermNode::stringify ( ) const
pure virtualinherited

◆ substitute()

unsigned int ExpressionBuilder::EBTernaryTermNode::substitute ( const EBSubstitutionRuleList rule)
virtual

Reimplemented from ExpressionBuilder::EBBinaryTermNode.

Definition at line 361 of file ExpressionBuilder.C.

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

Member Data Documentation

◆ _left

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_left
protectedinherited

Definition at line 199 of file ExpressionBuilder.h.

◆ _middle

EBTermNode* ExpressionBuilder::EBTernaryTermNode::_middle
protected

Definition at line 272 of file ExpressionBuilder.h.

◆ _right

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_right
protectedinherited

Definition at line 200 of file ExpressionBuilder.h.


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