amath  1.8.5
Simple command line calculator
SubtractionNode Class Reference

#include <operators.h>

Inheritance diagram for SubtractionNode:
Collaboration diagram for SubtractionNode:

Public Member Functions

 SubtractionNode (ExpressionNode *left, ExpressionNode *right)
 
ReductionType GetReductionType ()
 
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 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 135 of file operators.h.

Constructor & Destructor Documentation

◆ SubtractionNode()

SubtractionNode::SubtractionNode ( ExpressionNode left,
ExpressionNode right 
)

Definition at line 462 of file operators.cpp.

References NumericOperator::NumericOperator().

Referenced by Parser::ParseAddSubstract().

462  :
463  NumericOperator(left, right)
464 {
465 }
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 * SubtractionNode::Evaluate ( )
virtual

Implements ExpressionNode.

Definition at line 477 of file operators.cpp.

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

478 {
479  result = left->Evaluate()->Sub(right->Evaluate());
480  return result;
481 }
ExpressionNode * left
Definition: operators.h:119
virtual Number * Evaluate()=0
ExpressionNode * right
Definition: operators.h:120
Number * result
Definition: nodes.h:116
virtual Number * Sub(Number *other)=0
Here is the call graph for this function:

◆ GetNodeText()

char * SubtractionNode::GetNodeText ( )
protectedvirtual

Implements ExpressionNode.

Definition at line 483 of file operators.cpp.

484 {
485  static char* ret = (char*)"-";
486  return ret;
487 }

◆ GetPrecedence()

int SubtractionNode::GetPrecedence ( )
virtual

Implements ExpressionNode.

Definition at line 472 of file operators.cpp.

473 {
474  return 2;
475 }

◆ GetReductionType()

ReductionType SubtractionNode::GetReductionType ( )
virtual

Reimplemented from SyntaxNode.

Definition at line 467 of file operators.cpp.

References complsubreduc.

468 {
469  return complsubreduc;
470 }

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