amath  1.8.5 Simple command line calculator
ExpressionNode Class Referenceabstract

Base class for all nodes related to mathematical expressions. More...

#include <nodes.h>

Inheritance diagram for ExpressionNode:
Collaboration diagram for ExpressionNode:

## Public Member Functions

ExpressionNode ()

ExpressionNode (Number *value)

virtual ~ExpressionNode ()

NodeType GetNodeType ()

virtual bool IsSilent ()

virtual char * GetText ()=0

virtual NumberEvaluate ()=0

virtual int GetPrecedence ()=0

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 ()

virtual SyntaxNodeGetNext ()=0

virtual void Attach (SyntaxNode *node)=0

virtual void Detach (SyntaxNode *node)=0

virtual void Replace (SyntaxNode *n, SyntaxNode *x)=0

## Protected Member Functions

virtual char * GetNodeText ()=0

## Protected Attributes

Numberresult

Protected Attributes inherited from SyntaxNode
CharBufferoutput

SyntaxNodeparent

SyntaxNodeiterator

bool leftBottom

## Detailed Description

Base class for all nodes related to mathematical expressions.

Nodes of this type is used to build trees representing an mathematical expressions. Each node in the tree consist of a number, an operator or any other element in an expression.

Definition at line 99 of file nodes.h.

## ◆ ExpressionNode() [1/2]

 ExpressionNode::ExpressionNode ( )

Definition at line 89 of file nodes.cpp.

References result, and SyntaxNode::SyntaxNode().

89  :
90  SyntaxNode()
91 {
92  result = nullptr;
93 }
SyntaxNode()
Definition: nodes.cpp:42
Number * result
Definition: nodes.h:116
Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ ExpressionNode() [2/2]

 ExpressionNode::ExpressionNode ( Number * value )
explicit

Definition at line 95 of file nodes.cpp.

References result, and SyntaxNode::SyntaxNode().

Referenced by NumericValueNode::NumericValueNode().

95  :
96  SyntaxNode()
97 {
98  result = value;
99 }
SyntaxNode()
Definition: nodes.cpp:42
Number * result
Definition: nodes.h:116
Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ ~ExpressionNode()

 ExpressionNode::~ExpressionNode ( )
virtual

Definition at line 101 of file nodes.cpp.

References result.

102 {
103  if (result != nullptr)
104  {
105  delete result;
106  }
107 }
Number * result
Definition: nodes.h:116

## ◆ Execute()

 char * ExpressionNode::Execute ( )
virtual

Implements SyntaxNode.

Definition at line 124 of file nodes.cpp.

125 {
126  return nullptr;
127 }

## ◆ GetNodeText()

 virtual char* ExpressionNode::GetNodeText ( )
protectedpure virtual

Referenced by NumericOperator::GetText(), and GetTextCode().

Here is the caller graph for this function:

## ◆ GetNodeType()

 NodeType ExpressionNode::GetNodeType ( )
virtual

Implements SyntaxNode.

Definition at line 109 of file nodes.cpp.

References expression.

110 {
111  return expression;
112 }

## ◆ GetPrecedence()

 virtual int ExpressionNode::GetPrecedence ( )
pure virtual

Referenced by Optimizer::BalanceTree(), UnaryNode::GetText(), and NumericOperator::GetText().

Here is the caller graph for this function:

## ◆ GetText()

 virtual char* ExpressionNode::GetText ( )
pure virtual

Implemented in NumericValueNode, InsVariableNode, VariableNode, NumericOperator, FactorialNode, AbsoluteNode, FunctionNode, and UnaryNode.

Here is the caller graph for this function:

## ◆ GetTextCode()

 char * ExpressionNode::GetTextCode ( )
virtual

Implements SyntaxNode.

Definition at line 119 of file nodes.cpp.

References GetNodeText().

120 {
121  return GetNodeText();
122 }
virtual char * GetNodeText()=0
Here is the call graph for this function:

## ◆ IsSilent()

 bool ExpressionNode::IsSilent ( )
virtual

Reimplemented in AssignmentNode.

Definition at line 114 of file nodes.cpp.

Referenced by Parser::ParseEvaluation().

115 {
116  return false;
117 }
Here is the caller graph for this function:

## ◆ result

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