amath
1.8.5
Simple command line calculator
|
Represents a mathematical function in a syntax tree. More...
#include <node.h>
Public Member Functions | |
FunctionNode (ExpressionNode *expression, char *text, char *sys) | |
~FunctionNode () | |
int | GetPrecedence () |
char * | GetText () |
virtual SyntaxNode * | GetNext () |
virtual void | Attach (SyntaxNode *node) |
virtual void | Detach (SyntaxNode *node) |
virtual void | Replace (SyntaxNode *n, SyntaxNode *x) |
Public Member Functions inherited from ExpressionNode | |
ExpressionNode () | |
ExpressionNode (Number *value) | |
virtual | ~ExpressionNode () |
NodeType | GetNodeType () |
virtual bool | IsSilent () |
virtual Number * | Evaluate ()=0 |
char * | GetTextCode () |
char * | Execute () |
Public Member Functions inherited from SyntaxNode | |
SyntaxNode () | |
virtual | ~SyntaxNode () |
void | SetFirstNode () |
bool | GetFirstNode () const |
SyntaxNode * | GetParent () const |
void | SetParent (SyntaxNode *node) |
virtual ReductionType | GetReductionType () |
virtual void | ResetIterator () |
Protected Member Functions | |
virtual char * | GetNodeText () |
Protected Attributes | |
ExpressionNode * | expression |
char * | name |
char * | sysname |
Protected Attributes inherited from ExpressionNode | |
Number * | result |
Protected Attributes inherited from SyntaxNode | |
CharBuffer * | output |
SyntaxNode * | parent |
SyntaxNode * | iterator |
bool | leftBottom |
Represents a mathematical function in a syntax tree.
Function nodes in syntax trees can both be well known functions like cosine (cos) and also user defined functions. The function node represents a function call and not a function definition.
A formal description of mathematical functions can be found at Wikipedia: https://wikipedia.org/wiki/Function_(mathematics)
When instantiating a function node an argument must be supplied. The argument is a pointer to an expression node representing the value which should be used when computing the function value.
|
explicit |
Definition at line 34 of file node.cpp.
References AllocAndCopy(), expression, ExpressionNode::ExpressionNode(), name, and sysname.
Referenced by AbsoluteFunctionNode::AbsoluteFunctionNode(), ArcChordNode::ArcChordNode(), ArcCosecantNode::ArcCosecantNode(), ArcCosineNode::ArcCosineNode(), ArcCotangentNode::ArcCotangentNode(), ArcCoversedCosineNode::ArcCoversedCosineNode(), ArcCoversedSineNode::ArcCoversedSineNode(), ArcExcosecantNode::ArcExcosecantNode(), ArcExsecantNode::ArcExsecantNode(), ArcHaCoversedCosineNode::ArcHaCoversedCosineNode(), ArcHaCoversedSineNode::ArcHaCoversedSineNode(), ArcHaVersedCosineNode::ArcHaVersedCosineNode(), ArcHaVersedSineNode::ArcHaVersedSineNode(), ArcSecantNode::ArcSecantNode(), ArcSineNode::ArcSineNode(), ArcTangentNode::ArcTangentNode(), ArcVersedCosineNode::ArcVersedCosineNode(), ArcVersedSineNode::ArcVersedSineNode(), BinaryLogNode::BinaryLogNode(), CeilingNode::CeilingNode(), ChordNode::ChordNode(), CosecantNode::CosecantNode(), CosineNode::CosineNode(), CotangentNode::CotangentNode(), CoversedCosineNode::CoversedCosineNode(), CoversedSineNode::CoversedSineNode(), CubeRootNode::CubeRootNode(), ExcosecantNode::ExcosecantNode(), ExsecantNode::ExsecantNode(), FloorNode::FloorNode(), HaCoversedCosineNode::HaCoversedCosineNode(), HaCoversedSineNode::HaCoversedSineNode(), HaVersedCosineNode::HaVersedCosineNode(), HaVersedSineNode::HaVersedSineNode(), HyperbolicArcCosecantNode::HyperbolicArcCosecantNode(), HyperbolicArccosineNode::HyperbolicArccosineNode(), HyperbolicArcCotangentNode::HyperbolicArcCotangentNode(), HyperbolicArcSecantNode::HyperbolicArcSecantNode(), HyperbolicArcsineNode::HyperbolicArcsineNode(), HyperbolicArctangentNode::HyperbolicArctangentNode(), HyperbolicCosecantNode::HyperbolicCosecantNode(), HyperbolicCosineNode::HyperbolicCosineNode(), HyperbolicCotangentNode::HyperbolicCotangentNode(), HyperbolicSecantNode::HyperbolicSecantNode(), HyperbolicSineNode::HyperbolicSineNode(), HyperbolicTangentNode::HyperbolicTangentNode(), LnRootNode::LnRootNode(), LogNode::LogNode(), RoundNode::RoundNode(), SecantNode::SecantNode(), SignumNode::SignumNode(), SineNode::SineNode(), SquareRootNode::SquareRootNode(), TangentNode::TangentNode(), TruncNode::TruncNode(), UserFunctionNode::UserFunctionNode(), VersedCosineNode::VersedCosineNode(), and VersedSineNode::VersedSineNode().
FunctionNode::~FunctionNode | ( | ) |
|
virtual |
Implements SyntaxNode.
Reimplemented in UserFunctionNode.
Definition at line 97 of file node.cpp.
References expression, and SyntaxNode::SetParent().
|
virtual |
Implements SyntaxNode.
Reimplemented in UserFunctionNode.
Definition at line 106 of file node.cpp.
References expression.
|
virtual |
Implements SyntaxNode.
Reimplemented in UserFunctionNode.
Definition at line 86 of file node.cpp.
References expression, and SyntaxNode::iterator.
|
protectedvirtual |
Implements ExpressionNode.
Reimplemented in UserFunctionNode.
Definition at line 79 of file node.cpp.
References PreferencesBase::GetRefactorNames(), name, Program::Preferences, and sysname.
Referenced by GetText().
|
virtual |
|
virtual |
Implements ExpressionNode.
Definition at line 64 of file node.cpp.
References CharBuffer::Append(), CharBuffer::Empty(), CharBuffer::EnsureSize(), expression, GetNodeText(), CharBuffer::GetString(), ExpressionNode::GetText(), SyntaxNode::output, and StrLen().
|
virtual |
Implements SyntaxNode.
Reimplemented in UserFunctionNode.
Definition at line 114 of file node.cpp.
References expression.
|
protected |
Definition at line 66 of file node.h.
Referenced by Attach(), Detach(), AbsoluteFunctionNode::Evaluate(), UserFunctionNode::Evaluate(), ArcExcosecantNode::Evaluate(), TangentNode::Evaluate(), SquareRootNode::Evaluate(), SineNode::Evaluate(), ArcChordNode::Evaluate(), SecantNode::Evaluate(), ArcCoversedCosineNode::Evaluate(), ArcTangentNode::Evaluate(), ExcosecantNode::Evaluate(), CubeRootNode::Evaluate(), HaVersedCosineNode::Evaluate(), HaVersedSineNode::Evaluate(), ArcVersedCosineNode::Evaluate(), HyperbolicArcCosecantNode::Evaluate(), BinaryLogNode::Evaluate(), LogNode::Evaluate(), LnRootNode::Evaluate(), HyperbolicTangentNode::Evaluate(), HyperbolicSineNode::Evaluate(), HyperbolicSecantNode::Evaluate(), HyperbolicCotangentNode::Evaluate(), HyperbolicCosineNode::Evaluate(), HyperbolicCosecantNode::Evaluate(), HyperbolicArctangentNode::Evaluate(), HyperbolicArcsineNode::Evaluate(), HyperbolicArcSecantNode::Evaluate(), HyperbolicArccosineNode::Evaluate(), ArcCoversedSineNode::Evaluate(), ArcVersedSineNode::Evaluate(), HyperbolicArcCotangentNode::Evaluate(), CeilingNode::Evaluate(), ArcSineNode::Evaluate(), HaCoversedCosineNode::Evaluate(), FloorNode::Evaluate(), ExsecantNode::Evaluate(), ArcCosecantNode::Evaluate(), ArcHaVersedSineNode::Evaluate(), CoversedSineNode::Evaluate(), CoversedCosineNode::Evaluate(), CotangentNode::Evaluate(), CosineNode::Evaluate(), CosecantNode::Evaluate(), ArcCosineNode::Evaluate(), ArcHaCoversedCosineNode::Evaluate(), ChordNode::Evaluate(), ArcHaCoversedSineNode::Evaluate(), HaCoversedSineNode::Evaluate(), ArcCotangentNode::Evaluate(), ArcSecantNode::Evaluate(), ArcExsecantNode::Evaluate(), VersedSineNode::Evaluate(), ArcHaVersedCosineNode::Evaluate(), VersedCosineNode::Evaluate(), RoundNode::Evaluate(), SignumNode::Evaluate(), TruncNode::Evaluate(), FunctionNode(), GetNext(), GetText(), Replace(), and ~FunctionNode().
|
protected |
Definition at line 67 of file node.h.
Referenced by FunctionNode(), GetNodeText(), and ~FunctionNode().
|
protected |
Definition at line 68 of file node.h.
Referenced by FunctionNode(), GetNodeText(), and ~FunctionNode().