amath  1.8.5
Simple command line calculator
MultiplicationNode Class Reference

#include <operators.h>

Inheritance diagram for MultiplicationNode:
Collaboration diagram for MultiplicationNode:

Public Member Functions

 MultiplicationNode (ExpressionNode *left, ExpressionNode *right)
 
int GetPrecedence ()
 
NumberEvaluate ()
 
- Public Member Functions inherited from NumericOperator
 NumericOperator (ExpressionNode *left, ExpressionNode *right)
 
 ~NumericOperator ()
 
SyntaxNodeGetNext ()
 
char * GetText ()
 
void Attach (SyntaxNode *node)
 
void Detach (SyntaxNode *node)
 
void Replace (SyntaxNode *n, SyntaxNode *x)
 
- Public Member Functions inherited from ExpressionNode
 ExpressionNode ()
 
 ExpressionNode (Number *value)
 
virtual ~ExpressionNode ()
 
NodeType GetNodeType ()
 
virtual bool IsSilent ()
 
char * GetTextCode ()
 
char * Execute ()
 
- Public Member Functions inherited from SyntaxNode
 SyntaxNode ()
 
virtual ~SyntaxNode ()
 
void SetFirstNode ()
 
bool GetFirstNode () const
 
SyntaxNodeGetParent () const
 
void SetParent (SyntaxNode *node)
 
virtual ReductionType GetReductionType ()
 
virtual void ResetIterator ()
 

Protected Member Functions

char * GetNodeText ()
 

Additional Inherited Members

- Protected Attributes inherited from NumericOperator
ExpressionNodeleft
 
ExpressionNoderight
 
- Protected Attributes inherited from ExpressionNode
Numberresult
 
- Protected Attributes inherited from SyntaxNode
CharBufferoutput
 
SyntaxNodeparent
 
SyntaxNodeiterator
 
bool leftBottom
 

Detailed Description

Definition at line 147 of file operators.h.

Constructor & Destructor Documentation

◆ MultiplicationNode()

MultiplicationNode::MultiplicationNode ( ExpressionNode left,
ExpressionNode right 
)

Definition at line 493 of file operators.cpp.

References NumericOperator::NumericOperator().

Referenced by Parser::ParseFactor().

493  :
494  NumericOperator(left, right)
495 {
496 }
NumericOperator(ExpressionNode *left, ExpressionNode *right)
Definition: operators.cpp:308
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ Evaluate()

Number * MultiplicationNode::Evaluate ( )
virtual

Implements ExpressionNode.

Definition at line 503 of file operators.cpp.

References ExpressionNode::Evaluate(), NumericOperator::left, Number::Mul(), ExpressionNode::result, and NumericOperator::right.

504 {
505  result = left->Evaluate()->Mul(right->Evaluate());
506  return result;
507 }
virtual Number * Mul(Number *other)=0
ExpressionNode * left
Definition: operators.h:119
virtual Number * Evaluate()=0
ExpressionNode * right
Definition: operators.h:120
Number * result
Definition: nodes.h:116
Here is the call graph for this function:

◆ GetNodeText()

char * MultiplicationNode::GetNodeText ( )
protectedvirtual

Implements ExpressionNode.

Definition at line 509 of file operators.cpp.

510 {
511  static char* ret = (char*)"*";
512  return ret;
513 }

◆ GetPrecedence()

int MultiplicationNode::GetPrecedence ( )
virtual

Implements ExpressionNode.

Definition at line 498 of file operators.cpp.

499 {
500  return 3;
501 }

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