www.mooseframework.org
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
ExpressionBuilder::EBBinaryFuncTermNode Class Reference

Node representing a function with two arguments. More...

#include <ExpressionBuilder.h>

Inheritance diagram for ExpressionBuilder::EBBinaryFuncTermNode:
[legend]

Public Types

enum  NodeType {
  MIN, MAX, ATAN2, HYPOT,
  PLOG
}
 

Public Member Functions

 EBBinaryFuncTermNode (EBTermNode *left, EBTermNode *right, NodeType type)
 
virtual EBBinaryFuncTermNodeclone () const
 
virtual std::string stringify () const
 
virtual int precedence () const
 
virtual unsigned int substitute (const EBSubstitutionRuleList &rule)
 

Public Attributes

enum ExpressionBuilder::EBBinaryFuncTermNode::NodeType _type
 

Protected Attributes

EBTermNode_left
 
EBTermNode_right
 

Detailed Description

Node representing a function with two arguments.

Definition at line 238 of file ExpressionBuilder.h.

Member Enumeration Documentation

◆ NodeType

Constructor & Destructor Documentation

◆ EBBinaryFuncTermNode()

ExpressionBuilder::EBBinaryFuncTermNode::EBBinaryFuncTermNode ( EBTermNode left,
EBTermNode right,
NodeType  type 
)
inline

Definition at line 250 of file ExpressionBuilder.h.

251  : EBBinaryTermNode(left, right), _type(type){};
EBBinaryTermNode(EBTermNode *left, EBTermNode *right)
enum ExpressionBuilder::EBBinaryFuncTermNode::NodeType _type

Member Function Documentation

◆ clone()

virtual EBBinaryFuncTermNode* ExpressionBuilder::EBBinaryFuncTermNode::clone ( ) const
inlinevirtual

Implements ExpressionBuilder::EBTermNode.

Definition at line 252 of file ExpressionBuilder.h.

253  {
254  return new EBBinaryFuncTermNode(_left->clone(), _right->clone(), _type);
255  };
virtual EBTermNode * clone() const =0
enum ExpressionBuilder::EBBinaryFuncTermNode::NodeType _type
EBBinaryFuncTermNode(EBTermNode *left, EBTermNode *right, NodeType type)

◆ precedence()

virtual int ExpressionBuilder::EBBinaryFuncTermNode::precedence ( ) const
inlinevirtual

Implements ExpressionBuilder::EBTermNode.

Definition at line 258 of file ExpressionBuilder.h.

258 { return 2; }

◆ stringify()

std::string ExpressionBuilder::EBBinaryFuncTermNode::stringify ( ) const
virtual

Implements ExpressionBuilder::EBTermNode.

Definition at line 83 of file ExpressionBuilder.C.

84 {
85  const char * name[] = {"min", "max", "atan2", "hypot", "plog"};
86  std::ostringstream s;
87  s << name[_type] << '(' << *_left << ',' << *_right << ')';
88  return s.str();
89 }
const std::string name
Definition: Setup.h:22
enum ExpressionBuilder::EBBinaryFuncTermNode::NodeType _type

◆ substitute()

unsigned int ExpressionBuilder::EBBinaryTermNode::substitute ( const EBSubstitutionRuleList rule)
virtualinherited

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
protectedinherited

Definition at line 199 of file ExpressionBuilder.h.

◆ _right

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_right
protectedinherited

Definition at line 200 of file ExpressionBuilder.h.

◆ _type

enum ExpressionBuilder::EBBinaryFuncTermNode::NodeType ExpressionBuilder::EBBinaryFuncTermNode::_type

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