MoveLeft is working

This commit is contained in:
Léa Saviot
2018-06-26 17:32:22 +02:00
parent 9a7441d045
commit 2906d72aee
4 changed files with 20 additions and 5 deletions

View File

@@ -99,14 +99,11 @@ TreeNode * TreeNode::childTreeAtIndex(int i) const {
return child;
}
int TreeNode::indexOfChild(const TreeNode * child) const {
if (child == nullptr) {
return -1;
}
int TreeNode::indexOfChildByIdentifier(int childID) const {
int childrenCount = numberOfChildren();
TreeNode * childAtIndexi = next();
for (int i = 0; i < childrenCount; i++) {
if (childAtIndexi == child) {
if (childAtIndexi->identifier() == childID) {
return i;
}
childAtIndexi = childAtIndexi->nextSibling();
@@ -114,6 +111,13 @@ int TreeNode::indexOfChild(const TreeNode * child) const {
return -1;
}
int TreeNode::indexOfChild(const TreeNode * child) const {
if (child == nullptr) {
return -1;
}
return indexOfChildByIdentifier(child->identifier());
}
bool TreeNode::hasChild(const TreeNode * child) const {
if (child == nullptr) {
return false;