mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-23 15:50:49 +01:00
MoveLeft is working
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user