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

Constructor & Destructor Documentation

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

Definition at line 186 of file ExpressionBuilder.h.

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

Definition at line 187 of file ExpressionBuilder.h.

188  {
189  delete _left;
190  delete _right;
191  };

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

Reimplemented from ExpressionBuilder::EBTermNode.

Reimplemented in ExpressionBuilder::EBTernaryTermNode.

Definition at line 323 of file ExpressionBuilder.C.

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

Member Data Documentation

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_left
protected

Definition at line 196 of file ExpressionBuilder.h.

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_right
protected

Definition at line 197 of file ExpressionBuilder.h.


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