| 625 | } |
| 626 | |
| 627 | void |
| 628 | TreeCanvas::inspectCurrentNode(bool fix, int inspectorNo) { |
| 629 | QMutexLocker locker(&mutex); |
| 630 | |
| 631 | if (currentNode->isHidden()) { |
| 632 | toggleHidden(); |
| 633 | return; |
| 634 | } |
| 635 | |
| 636 | int failedInspectorType = -1; |
| 637 | int failedInspector = -1; |
| 638 | bool needCentering = false; |
| 639 | try { |
| 640 | switch (currentNode->getStatus()) { |
| 641 | case UNDETERMINED: |
| 642 | { |
| 643 | unsigned int kids = |
| 644 | currentNode->getNumberOfChildNodes(*na,curBest,stats,c_d,a_d); |
| 645 | int depth = -1; |
| 646 | for (VisualNode* p = currentNode; p != nullptr; p=p->getParent(*na)) |
| 647 | depth++; |
| 648 | if (kids > 0) { |
| 649 | needCentering = true; |
| 650 | depth++; |
| 651 | } |
| 652 | stats.maxDepth = |
| 653 | std::max(stats.maxDepth, depth); |
| 654 | if (currentNode->getStatus() == SOLVED) { |
| 655 | assert(currentNode->hasCopy()); |
| 656 | emit solution(currentNode->getWorkingSpace()); |
| 657 | } |
| 658 | emit statusChanged(currentNode,stats,true); |
| 659 | for (int i=0; i<moveInspectors.size(); i++) { |
| 660 | if (moveInspectors[i].second) { |
| 661 | failedInspectorType = 0; |
| 662 | failedInspector = i; |
| 663 | if (currentNode->getStatus() == FAILED) { |
| 664 | if (!currentNode->isRoot()) { |
| 665 | Space* curSpace = |
| 666 | currentNode->getSpace(*na,curBest,c_d,a_d); |
| 667 | moveInspectors[i].first->inspect(*curSpace); |
| 668 | delete curSpace; |
| 669 | } |
| 670 | } else { |
| 671 | moveInspectors[i].first-> |
| 672 | inspect(*currentNode->getWorkingSpace()); |
| 673 | } |
| 674 | failedInspectorType = -1; |
| 675 | } |
| 676 | } |
| 677 | if (currentNode->getStatus() == SOLVED) { |
| 678 | currentNode->purge(*na); |
| 679 | } |
| 680 | } |
| 681 | break; |
| 682 | case FAILED: |
| 683 | case STOP: |
| 684 | case UNSTOP: |
no test coverage detected