www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
ExpressionBuilder::EBBinaryTermNode 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::EBBinaryTermNode:
[legend]

Public Member Functions

 EBBinaryTermNode (EBTermNode *left, EBTermNode *right)
 
virtual ~EBBinaryTermNode ()
 
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_left
 
EBTermNode_right
 

Detailed Description

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

Definition at line 186 of file ExpressionBuilder.h.

Constructor & Destructor Documentation

◆ EBBinaryTermNode()

ExpressionBuilder::EBBinaryTermNode::EBBinaryTermNode ( EBTermNode left,
EBTermNode right 
)
inline

Definition at line 189 of file ExpressionBuilder.h.

◆ ~EBBinaryTermNode()

virtual ExpressionBuilder::EBBinaryTermNode::~EBBinaryTermNode ( )
inlinevirtual

Definition at line 190 of file ExpressionBuilder.h.

191  {
192  delete _left;
193  delete _right;
194  };

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::EBBinaryTermNode::substitute ( const EBSubstitutionRuleList rule)
virtual

Reimplemented from ExpressionBuilder::EBTermNode.

Reimplemented in ExpressionBuilder::EBTernaryTermNode.

Definition at line 326 of file ExpressionBuilder.C.

327 {
328  unsigned int nrule = rules.size();
329  unsigned int success = 0;
330 
331  for (unsigned int i = 0; i < nrule; ++i)
332  {
333  EBTermNode * replace = rules[i]->apply(_left);
334  if (replace != NULL)
335  {
336  delete _left;
337  _left = replace;
338  success = 1;
339  break;
340  }
341  }
342 
343  if (success == 0)
344  success += _left->substitute(rules);
345 
346  for (unsigned int i = 0; i < nrule; ++i)
347  {
348  EBTermNode * replace = rules[i]->apply(_right);
349  if (replace != NULL)
350  {
351  delete _right;
352  _right = replace;
353  return success + 1;
354  }
355  }
356 
357  return success + _right->substitute(rules);
358 }
virtual unsigned int substitute(const EBSubstitutionRuleList &)

Member Data Documentation

◆ _left

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_left
protected

Definition at line 199 of file ExpressionBuilder.h.

◆ _right

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_right
protected

Definition at line 200 of file ExpressionBuilder.h.


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