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

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

#include <ExpressionBuilder.h>

Inheritance diagram for ExpressionBuilder::EBTernaryFuncTermNode:
[legend]

Public Types

enum  NodeType { CONDITIONAL }
 

Public Member Functions

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

Public Attributes

enum ExpressionBuilder::EBTernaryFuncTermNode::NodeType _type
 

Protected Attributes

EBTermNode_middle
 
EBTermNode_left
 
EBTermNode_right
 

Detailed Description

Node representing a function with three arguments.

Definition at line 276 of file ExpressionBuilder.h.

Member Enumeration Documentation

◆ NodeType

Enumerator
CONDITIONAL 

Definition at line 279 of file ExpressionBuilder.h.

280  {
282  } _type;
enum ExpressionBuilder::EBTernaryFuncTermNode::NodeType _type

Constructor & Destructor Documentation

◆ EBTernaryFuncTermNode()

ExpressionBuilder::EBTernaryFuncTermNode::EBTernaryFuncTermNode ( EBTermNode left,
EBTermNode middle,
EBTermNode right,
NodeType  type 
)
inline

Definition at line 284 of file ExpressionBuilder.h.

285  : EBTernaryTermNode(left, middle, right), _type(type){};
enum ExpressionBuilder::EBTernaryFuncTermNode::NodeType _type
EBTernaryTermNode(EBTermNode *left, EBTermNode *middle, EBTermNode *right)

Member Function Documentation

◆ clone()

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

Implements ExpressionBuilder::EBTermNode.

Definition at line 286 of file ExpressionBuilder.h.

287  {
289  };
virtual EBTermNode * clone() const =0
enum ExpressionBuilder::EBTernaryFuncTermNode::NodeType _type
EBTernaryFuncTermNode(EBTermNode *left, EBTermNode *middle, EBTermNode *right, NodeType type)

◆ precedence()

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

Implements ExpressionBuilder::EBTermNode.

Definition at line 292 of file ExpressionBuilder.h.

292 { return 2; }

◆ stringify()

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

Implements ExpressionBuilder::EBTermNode.

Definition at line 144 of file ExpressionBuilder.C.

145 {
146  const char * name[] = {"if"};
147  std::ostringstream s;
148  s << name[_type] << '(' << *_left << ',' << *_middle << ',' << *_right << ')';
149  return s.str();
150 }
enum ExpressionBuilder::EBTernaryFuncTermNode::NodeType _type
const std::string name
Definition: Setup.h:22

◆ substitute()

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

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
protectedinherited

Definition at line 272 of file ExpressionBuilder.h.

◆ _right

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_right
protectedinherited

Definition at line 200 of file ExpressionBuilder.h.

◆ _type

enum ExpressionBuilder::EBTernaryFuncTermNode::NodeType ExpressionBuilder::EBTernaryFuncTermNode::_type

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