mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-23 15:50:49 +01:00
Rename operand to child
This commit is contained in:
@@ -17,8 +17,8 @@ public:
|
||||
}
|
||||
float approximate() override {
|
||||
float result = 0.0f;
|
||||
for (int i=0; i<numberOfOperands(); i++) {
|
||||
result += operand(i)->approximate();
|
||||
for (int i=0; i<numberOfChildren(); i++) {
|
||||
result += child(i)->approximate();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -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<ExpressionNode *>(childAtIndex(i)); }
|
||||
ExpressionNode * child(int i) { return static_cast<ExpressionNode *>(treeChildAtIndex(i)); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user