From edce759ae58a5d36ecae4cd49896c43344811827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Fri, 22 Jun 2018 10:24:14 +0200 Subject: [PATCH] Rename operand to child --- addition_node.h | 4 ++-- expression_node.h | 7 +------ tree_node.h | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/addition_node.h b/addition_node.h index e60f2143b..b03278a70 100644 --- a/addition_node.h +++ b/addition_node.h @@ -17,8 +17,8 @@ public: } float approximate() override { float result = 0.0f; - for (int i=0; iapproximate(); + for (int i=0; iapproximate(); } return result; } diff --git a/expression_node.h b/expression_node.h index 7cd7bdffd..433bb5ce7 100644 --- a/expression_node.h +++ b/expression_node.h @@ -5,13 +5,8 @@ class ExpressionNode : public TreeNode { public: - ExpressionNode() : TreeNode(TreePool::sharedPool()->generateIdentifier()) { - TreePool::sharedPool()->registerNode(this); - } - virtual float approximate() = 0; - int numberOfOperands() { return numberOfChildren(); } - ExpressionNode * operand(int i) { return static_cast(childAtIndex(i)); } + ExpressionNode * child(int i) { return static_cast(treeChildAtIndex(i)); } }; #endif diff --git a/tree_node.h b/tree_node.h index 0a0cdfc9d..f94978c70 100644 --- a/tree_node.h +++ b/tree_node.h @@ -100,7 +100,7 @@ public: return 0; } - TreeNode * childAtIndex(int i) const { + TreeNode * treeChildAtIndex(int i) const { assert(i >= 0); assert(i < numberOfChildren()); TreeNode * child = next();