aboutsummaryrefslogtreecommitdiff
path: root/src/nodes.h
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-03-04 17:02:24 +0100
committerAdrian Kummerländer2014-03-04 17:02:24 +0100
commit9db4e054627eb30b4e5a7333405c423df5a8d490 (patch)
treecaeadcad4fe8e4ae5a910f4d7553a4bcf33d3dab /src/nodes.h
parent585fb99f7b3b97ff18ad804c40e9557dea1d064b (diff)
downloadSimpleParser-9db4e054627eb30b4e5a7333405c423df5a8d490.tar
SimpleParser-9db4e054627eb30b4e5a7333405c423df5a8d490.tar.gz
SimpleParser-9db4e054627eb30b4e5a7333405c423df5a8d490.tar.bz2
SimpleParser-9db4e054627eb30b4e5a7333405c423df5a8d490.tar.lz
SimpleParser-9db4e054627eb30b4e5a7333405c423df5a8d490.tar.xz
SimpleParser-9db4e054627eb30b4e5a7333405c423df5a8d490.tar.zst
SimpleParser-9db4e054627eb30b4e5a7333405c423df5a8d490.zip
Did some refactoring to improve readability
* now using range for-loops during Tree printing * inroduced popNode helper method which helps to simplify the Tree construction implementation
Diffstat (limited to 'src/nodes.h')
-rw-r--r--src/nodes.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nodes.h b/src/nodes.h
index 170b88f..2581a2d 100644
--- a/src/nodes.h
+++ b/src/nodes.h
@@ -20,9 +20,9 @@ class Node {
virtual ~Node() {};
virtual double solve() = 0;
- virtual NodeType getType() = 0;
+ virtual NodeType type() = 0;
virtual std::string print() = 0;
-
+
Node* leftChild;
Node* rightChild;
};
@@ -32,10 +32,10 @@ class OperatorNode: public Node {
explicit OperatorNode(TokenType);
virtual double solve();
- virtual NodeType getType();
+ virtual NodeType type();
virtual std::string print();
- TokenType getToken();
+ TokenType token();
private:
TokenType operator_;
@@ -46,7 +46,7 @@ class OperandNode: public Node {
explicit OperandNode(double);
virtual double solve();
- virtual NodeType getType();
+ virtual NodeType type();
virtual std::string print();
private:
@@ -58,7 +58,7 @@ class ConstantNode: public Node {
explicit ConstantNode(std::string, const ConstantMap*);
virtual double solve();
- virtual NodeType getType();
+ virtual NodeType type();
virtual std::string print();
private: