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.

Constructor & Destructor Documentation

◆ ExpressionNode() [1/2]

ExpressionNode::ExpressionNode ( )

Definition at line 89 of file nodes.cpp.

References result, and SyntaxNode::SyntaxNode().

Referenced by AbsoluteNode::AbsoluteNode(), FactorialNode::FactorialNode(), FunctionNode::FunctionNode(), NumericOperator::NumericOperator(), UnaryNode::UnaryNode(), and VariableNode::VariableNode().

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

Member Function Documentation

◆ Evaluate()

virtual Number* ExpressionNode::Evaluate ( )
pure virtual

Implemented in AssignmentNode, PowerNode, DivisionNode, NumericValueNode, MultiplicationNode, SubtractionNode, InsVariableNode, AdditionNode, VariableNode, FactorialNode, AbsoluteNode, UnaryNode, TruncNode, RoundNode, SignumNode, ArcExcosecantNode, ArcExsecantNode, ArcChordNode, ArcCosineNode, ArcCosecantNode, ArcCotangentNode, ArcCoversedCosineNode, ArcCoversedSineNode, ArcHaCoversedCosineNode, ArcHaCoversedSineNode, ArcHaVersedCosineNode, ArcHaVersedSineNode, ArcSecantNode, ArcSineNode, ArcTangentNode, ArcVersedCosineNode, ArcVersedSineNode, CeilingNode, ChordNode, CosecantNode, CosineNode, CotangentNode, CoversedCosineNode, CoversedSineNode, CubeRootNode, ExcosecantNode, ExsecantNode, FloorNode, HaCoversedCosineNode, HaCoversedSineNode, HaVersedCosineNode, HaVersedSineNode, HyperbolicArcCosecantNode, HyperbolicArccosineNode, HyperbolicArcCotangentNode, HyperbolicArcSecantNode, HyperbolicArcsineNode, HyperbolicArctangentNode, HyperbolicCosecantNode, HyperbolicCosineNode, HyperbolicCotangentNode, HyperbolicSecantNode, HyperbolicSineNode, HyperbolicTangentNode, LnRootNode, LogNode, BinaryLogNode, SecantNode, SineNode, SquareRootNode, TangentNode, VersedCosineNode, VersedSineNode, UserFunctionNode, and AbsoluteFunctionNode.

Referenced by AbsoluteFunctionNode::Evaluate(), UserFunctionNode::Evaluate(), ArcExsecantNode::Evaluate(), ArcCotangentNode::Evaluate(), ArcSineNode::Evaluate(), HaCoversedSineNode::Evaluate(), HaVersedCosineNode::Evaluate(), ArcTangentNode::Evaluate(), HaVersedSineNode::Evaluate(), HyperbolicArcCosecantNode::Evaluate(), ArcCoversedCosineNode::Evaluate(), VersedSineNode::Evaluate(), VersedCosineNode::Evaluate(), ExcosecantNode::Evaluate(), ArcVersedCosineNode::Evaluate(), TangentNode::Evaluate(), SquareRootNode::Evaluate(), SineNode::Evaluate(), HyperbolicArccosineNode::Evaluate(), SecantNode::Evaluate(), HyperbolicArcCotangentNode::Evaluate(), BinaryLogNode::Evaluate(), ArcVersedSineNode::Evaluate(), LnRootNode::Evaluate(), HyperbolicTangentNode::Evaluate(), HyperbolicSineNode::Evaluate(), HyperbolicSecantNode::Evaluate(), HyperbolicCotangentNode::Evaluate(), HyperbolicCosineNode::Evaluate(), HyperbolicCosecantNode::Evaluate(), HyperbolicArctangentNode::Evaluate(), HyperbolicArcSecantNode::Evaluate(), HyperbolicArcsineNode::Evaluate(), ArcChordNode::Evaluate(), ArcCoversedSineNode::Evaluate(), CeilingNode::Evaluate(), ChordNode::Evaluate(), ArcHaCoversedCosineNode::Evaluate(), CosecantNode::Evaluate(), HaCoversedCosineNode::Evaluate(), FloorNode::Evaluate(), ExsecantNode::Evaluate(), ArcHaVersedSineNode::Evaluate(), CubeRootNode::Evaluate(), CoversedSineNode::Evaluate(), CoversedCosineNode::Evaluate(), LogNode::Evaluate(), CosineNode::Evaluate(), ArcCosineNode::Evaluate(), ArcHaCoversedSineNode::Evaluate(), CotangentNode::Evaluate(), ArcHaVersedCosineNode::Evaluate(), ArcExcosecantNode::Evaluate(), ArcCosecantNode::Evaluate(), ArcSecantNode::Evaluate(), RoundNode::Evaluate(), SignumNode::Evaluate(), TruncNode::Evaluate(), UnaryNode::Evaluate(), AbsoluteNode::Evaluate(), FactorialNode::Evaluate(), AdditionNode::Evaluate(), SubtractionNode::Evaluate(), MultiplicationNode::Evaluate(), DivisionNode::Evaluate(), PowerNode::Evaluate(), AssignmentNode::Evaluate(), EvalStatement::Execute(), and Grid::FunctionValue().

Here is the caller graph for this function:

◆ 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

◆ 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

◆ GetText()

◆ 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:

Member Data Documentation

◆ result

Number* ExpressionNode::result
protected

Definition at line 116 of file nodes.h.

Referenced by AbsoluteFunctionNode::Evaluate(), ArcExcosecantNode::Evaluate(), ArcChordNode::Evaluate(), ArcCoversedCosineNode::Evaluate(), ArcTangentNode::Evaluate(), HaVersedCosineNode::Evaluate(), HaVersedSineNode::Evaluate(), ArcVersedCosineNode::Evaluate(), HyperbolicArcCosecantNode::Evaluate(), HyperbolicArccosineNode::Evaluate(), ArcCoversedSineNode::Evaluate(), ArcVersedSineNode::Evaluate(), HyperbolicArcCotangentNode::Evaluate(), HyperbolicArcSecantNode::Evaluate(), CeilingNode::Evaluate(), HyperbolicArcsineNode::Evaluate(), VersedSineNode::Evaluate(), VersedCosineNode::Evaluate(), HyperbolicArctangentNode::Evaluate(), TangentNode::Evaluate(), SquareRootNode::Evaluate(), SineNode::Evaluate(), ArcCosineNode::Evaluate(), SecantNode::Evaluate(), ArcHaCoversedCosineNode::Evaluate(), BinaryLogNode::Evaluate(), LogNode::Evaluate(), LnRootNode::Evaluate(), HyperbolicTangentNode::Evaluate(), HyperbolicSineNode::Evaluate(), HyperbolicSecantNode::Evaluate(), HyperbolicCotangentNode::Evaluate(), ChordNode::Evaluate(), HyperbolicCosecantNode::Evaluate(), HyperbolicCosineNode::Evaluate(), CosecantNode::Evaluate(), ArcHaCoversedSineNode::Evaluate(), CosineNode::Evaluate(), CotangentNode::Evaluate(), ArcExsecantNode::Evaluate(), ArcCosecantNode::Evaluate(), ArcHaVersedCosineNode::Evaluate(), HaCoversedSineNode::Evaluate(), HaCoversedCosineNode::Evaluate(), FloorNode::Evaluate(), ExsecantNode::Evaluate(), ExcosecantNode::Evaluate(), CubeRootNode::Evaluate(), CoversedCosineNode::Evaluate(), CoversedSineNode::Evaluate(), ArcHaVersedSineNode::Evaluate(), ArcCotangentNode::Evaluate(), ArcSecantNode::Evaluate(), ArcSineNode::Evaluate(), RoundNode::Evaluate(), SignumNode::Evaluate(), TruncNode::Evaluate(), UnaryNode::Evaluate(), AbsoluteNode::Evaluate(), FactorialNode::Evaluate(), VariableNode::Evaluate(), AdditionNode::Evaluate(), SubtractionNode::Evaluate(), MultiplicationNode::Evaluate(), NumericValueNode::Evaluate(), DivisionNode::Evaluate(), PowerNode::Evaluate(), ExpressionNode(), NumericValueNode::GetNodeText(), NumericValueNode::GetPrecedence(), NumericValueNode::ReplaceWith(), and ~ExpressionNode().


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