amath  1.8.5
Simple command line calculator
DivisionNode Class Reference

#include <operators.h>

Inheritance diagram for DivisionNode:
Collaboration diagram for DivisionNode:

Public Member Functions

 DivisionNode (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 158 of file operators.h.

Constructor & Destructor Documentation

◆ DivisionNode()

DivisionNode::DivisionNode ( ExpressionNode left,
ExpressionNode right 
)

Definition at line 519 of file operators.cpp.

References NumericOperator::NumericOperator().

Referenced by Parser::ParseFactor().

519  :
520  NumericOperator(left, right)
521 {
522 }
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 * DivisionNode::Evaluate ( )
virtual

Implements ExpressionNode.

Definition at line 529 of file operators.cpp.

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

530 {
531  result = left->Evaluate()->Div(right->Evaluate());
532  return result;
533 }
ExpressionNode * left
Definition: operators.h:119
virtual Number * Evaluate()=0
ExpressionNode * right
Definition: operators.h:120
Number * result
Definition: nodes.h:116
virtual Number * Div(Number *other)=0
Here is the call graph for this function:

◆ GetNodeText()

char * DivisionNode::GetNodeText ( )
protectedvirtual

Implements ExpressionNode.

Definition at line 535 of file operators.cpp.

536 {
537  static char* ret = (char*)"/";
538  return ret;
539 }

◆ GetPrecedence()

int DivisionNode::GetPrecedence ( )
virtual

Implements ExpressionNode.

Definition at line 524 of file operators.cpp.

525 {
526  return 3;
527 }

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