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

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 247 of file ExpressionBuilder.h.

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

Member Function Documentation

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

Implements ExpressionBuilder::EBTermNode.

Definition at line 249 of file ExpressionBuilder.h.

250  {
251  return new EBBinaryFuncTermNode(_left->clone(), _right->clone(), _type);
252  };
virtual EBTermNode * clone() const =0
enum ExpressionBuilder::EBBinaryFuncTermNode::NodeType _type
EBBinaryFuncTermNode(EBTermNode *left, EBTermNode *right, NodeType type)
virtual int ExpressionBuilder::EBBinaryFuncTermNode::precedence ( ) const
inlinevirtual

Implements ExpressionBuilder::EBTermNode.

Definition at line 255 of file ExpressionBuilder.h.

255 { return 2; }
std::string ExpressionBuilder::EBBinaryFuncTermNode::stringify ( ) const
virtual

Implements ExpressionBuilder::EBTermNode.

Definition at line 80 of file ExpressionBuilder.C.

81 {
82  const char * name[] = {"min", "max", "atan2", "hypot", "plog"};
83  std::ostringstream s;
84  s << name[_type] << '(' << *_left << ',' << *_right << ')';
85  return s.str();
86 }
enum ExpressionBuilder::EBBinaryFuncTermNode::NodeType _type
unsigned int ExpressionBuilder::EBBinaryTermNode::substitute ( const EBSubstitutionRuleList rule)
virtualinherited

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
protectedinherited

Definition at line 196 of file ExpressionBuilder.h.

EBTermNode* ExpressionBuilder::EBBinaryTermNode::_right
protectedinherited

Definition at line 197 of file ExpressionBuilder.h.

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

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