/*
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
*
* This file is part of the reasoning system Konclude.
* For details and support, see .
*
* Konclude is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU Lesser General Public
* License (LGPLv3) as published by the Free Software Foundation.
*
* Konclude is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU (Lesser) General Public License for more details.
*
* You should have received a copy of the GNU (Lesser) General Public
* License along with Konclude. If not, see .
*
*/
#include "CNodeTopDownTraversalClassificationItem.h"
namespace Konclude {
namespace Reasoner {
namespace Classifier {
CNodeTopDownTraversalClassificationItem::CNodeTopDownTraversalClassificationItem(CHierarchyNode *node, CHierarchyNode *topNode, QList *lockedReleaseProcessingList) {
traversalNode = node;
newBranchNodeList << topNode;
lockedReleaseProcList = lockedReleaseProcessingList;
testNode = 0;
parLockNode = 0;
eqTestNode = 0;
subSumTestingResult = false;
alredyTraversedDirectBlockedSuccessorNode = false;
}
CNodeTopDownTraversalClassificationItem::~CNodeTopDownTraversalClassificationItem() {
}
CNodeBlockedClassificationItem *CNodeTopDownTraversalClassificationItem::releaseBlockedResumeProcessing() {
lockedReleaseProcList->append(this);
return this;
}
CNodeBlockedClassificationItem *CNodeTopDownTraversalClassificationItem::releaseTestingBlockedResumeProcessing(CConcept *subsumerConcept, CConcept *subsumedConcept, bool testingResult) {
subSumTestingResult = testingResult;
lockedReleaseProcList->append(this);
return this;
}
CHierarchyNode *CNodeTopDownTraversalClassificationItem::getTraversalNode() {
return traversalNode;
}
QList *CNodeTopDownTraversalClassificationItem::getTestingNodeList() {
return &testingNodeList;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendTestingNodeList(QList &nodeList) {
testingNodeList << nodeList;
return this;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendTestingNode(CHierarchyNode *node) {
testingNodeList.append(node);
return this;
}
QList *CNodeTopDownTraversalClassificationItem::getParentNodeList() {
return &parentNodeList;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendParentNodeList(QList &nodeList) {
parentNodeList << nodeList;
return this;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendParentNode(CHierarchyNode *node) {
parentNodeList.append(node);
return this;
}
bool CNodeTopDownTraversalClassificationItem::hasNextTestingNode() {
return !testingNodeList.isEmpty();
}
CHierarchyNode *CNodeTopDownTraversalClassificationItem::takeNextTestingNode() {
testNode = testingNodeList.takeFirst();
return testNode;
}
CHierarchyNode *CNodeTopDownTraversalClassificationItem::getTestingNode() {
return testNode;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::clearTestingNode() {
testNode = 0;
return this;
}
bool CNodeTopDownTraversalClassificationItem::getTestingResult() {
return subSumTestingResult;
}
QList *CNodeTopDownTraversalClassificationItem::getBranchLockedNodeList() {
return &branchLockedNodeList;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendBranchLockedNodeList(QList &nodeList) {
foreach (CHierarchyNode *node, nodeList) {
appendBranchLockedNode(node);
}
return this;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendBranchLockedNode(CHierarchyNode *branchNode) {
if (!branchLockedNodeSet.contains(branchNode)) {
branchLockedNodeSet.insert(branchNode);
branchLockedNodeList.append(branchNode);
}
return this;
}
bool CNodeTopDownTraversalClassificationItem::hasDirectBranchLockedNode() {
return parLockNode != 0;
}
CHierarchyNode *CNodeTopDownTraversalClassificationItem::getDirectBranchLockedNode() {
return parLockNode;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::setDirectBranchLockedNode(CHierarchyNode *parentLockedNode) {
parLockNode = parentLockedNode;
return this;
}
QList *CNodeTopDownTraversalClassificationItem::getNewBranchNodeList() {
return &newBranchNodeList;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendNewBranchNodeList(QList &nodeList) {
newBranchNodeList << nodeList;
return this;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendNewBranchNode(CHierarchyNode *branchNode) {
newBranchNodeList.append(branchNode);
return this;
}
CHierarchyNode *CNodeTopDownTraversalClassificationItem::getEquivalentTestingNode() {
return eqTestNode;
}
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::setEquivalentTestingNode(CHierarchyNode *equivalentTestingNode) {
eqTestNode = equivalentTestingNode;
return this;
}
CNodeTopDownTraversalClassificationItem* CNodeTopDownTraversalClassificationItem::setAlreadyTraversedDirectBlockedSuccessorNode(bool alredyTraversed) {
alredyTraversedDirectBlockedSuccessorNode = alredyTraversed;
return this;
}
bool CNodeTopDownTraversalClassificationItem::hasAlreadyTraversedDirectBlockedSuccessorNode() {
return alredyTraversedDirectBlockedSuccessorNode;
}
}; // end namespace Classifier
}; // end namespace Reasoner
}; // end namespace Konclude