amath  1.8.5
Simple command line calculator
PowerNode Class Reference

#include <operators.h>

Inheritance diagram for PowerNode:
Collaboration diagram for PowerNode:

Public Member Functions

 PowerNode (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 169 of file operators.h.

Constructor & Destructor Documentation

◆ PowerNode()

PowerNode::PowerNode ( ExpressionNode left,
ExpressionNode right 
)

Definition at line 545 of file operators.cpp.

References NumericOperator::NumericOperator().

Referenced by Parser::ParsePower().

545  :
546  NumericOperator(left, right)
547 {
548 }
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 * PowerNode::Evaluate ( )
virtual

Implements ExpressionNode.

Definition at line 555 of file operators.cpp.

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

556 {
557  Number* exponent = right->Evaluate();
558  result = left->Evaluate()->Raise(exponent);
559  return result;
560 }
virtual Number * Raise(Number *exponent)=0
Definition: numb.h:66
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 * PowerNode::GetNodeText ( )
protectedvirtual

Implements ExpressionNode.

Definition at line 562 of file operators.cpp.

563 {
564  static char* ret = (char*)"^";
565  return ret;
566 }

◆ GetPrecedence()

int PowerNode::GetPrecedence ( )
virtual

Implements ExpressionNode.

Definition at line 550 of file operators.cpp.

551 {
552  return 4;
553 }

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