| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "CNodeTopDownTraversalClassificationItem.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Classifier { |
| 29 |
|
| 30 |
|
| 31 |
CNodeTopDownTraversalClassificationItem::CNodeTopDownTraversalClassificationItem(CHierarchyNode *node, CHierarchyNode *topNode, QList<CNodeTopDownTraversalClassificationItem *> *lockedReleaseProcessingList) { |
| 32 |
traversalNode = node; |
| 33 |
newBranchNodeList << topNode; |
| 34 |
lockedReleaseProcList = lockedReleaseProcessingList; |
| 35 |
testNode = 0; |
| 36 |
parLockNode = 0; |
| 37 |
eqTestNode = 0; |
| 38 |
subSumTestingResult = false; |
| 39 |
alredyTraversedDirectBlockedSuccessorNode = false; |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
CNodeTopDownTraversalClassificationItem::~CNodeTopDownTraversalClassificationItem() { |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
CNodeBlockedClassificationItem *CNodeTopDownTraversalClassificationItem::releaseBlockedResumeProcessing() { |
| 49 |
lockedReleaseProcList->append(this); |
| 50 |
return this; |
| 51 |
} |
| 52 |
|
| 53 |
CNodeBlockedClassificationItem *CNodeTopDownTraversalClassificationItem::releaseTestingBlockedResumeProcessing(CConcept *subsumerConcept, CConcept *subsumedConcept, bool testingResult) { |
| 54 |
subSumTestingResult = testingResult; |
| 55 |
lockedReleaseProcList->append(this); |
| 56 |
return this; |
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
CHierarchyNode *CNodeTopDownTraversalClassificationItem::getTraversalNode() { |
| 62 |
return traversalNode; |
| 63 |
} |
| 64 |
|
| 65 |
QList<CHierarchyNode *> *CNodeTopDownTraversalClassificationItem::getTestingNodeList() { |
| 66 |
return &testingNodeList; |
| 67 |
} |
| 68 |
|
| 69 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendTestingNodeList(QList<CHierarchyNode *> &nodeList) { |
| 70 |
testingNodeList << nodeList; |
| 71 |
return this; |
| 72 |
} |
| 73 |
|
| 74 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendTestingNode(CHierarchyNode *node) { |
| 75 |
testingNodeList.append(node); |
| 76 |
return this; |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
QList<CHierarchyNode *> *CNodeTopDownTraversalClassificationItem::getParentNodeList() { |
| 81 |
return &parentNodeList; |
| 82 |
} |
| 83 |
|
| 84 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendParentNodeList(QList<CHierarchyNode *> &nodeList) { |
| 85 |
parentNodeList << nodeList; |
| 86 |
return this; |
| 87 |
} |
| 88 |
|
| 89 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendParentNode(CHierarchyNode *node) { |
| 90 |
parentNodeList.append(node); |
| 91 |
return this; |
| 92 |
} |
| 93 |
|
| 94 |
bool CNodeTopDownTraversalClassificationItem::hasNextTestingNode() { |
| 95 |
return !testingNodeList.isEmpty(); |
| 96 |
} |
| 97 |
|
| 98 |
CHierarchyNode *CNodeTopDownTraversalClassificationItem::takeNextTestingNode() { |
| 99 |
testNode = testingNodeList.takeFirst(); |
| 100 |
return testNode; |
| 101 |
} |
| 102 |
|
| 103 |
CHierarchyNode *CNodeTopDownTraversalClassificationItem::getTestingNode() { |
| 104 |
return testNode; |
| 105 |
} |
| 106 |
|
| 107 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::clearTestingNode() { |
| 108 |
testNode = 0; |
| 109 |
return this; |
| 110 |
} |
| 111 |
|
| 112 |
bool CNodeTopDownTraversalClassificationItem::getTestingResult() { |
| 113 |
return subSumTestingResult; |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
QList<CHierarchyNode *> *CNodeTopDownTraversalClassificationItem::getBranchLockedNodeList() { |
| 118 |
return &branchLockedNodeList; |
| 119 |
} |
| 120 |
|
| 121 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendBranchLockedNodeList(QList<CHierarchyNode *> &nodeList) { |
| 122 |
foreach (CHierarchyNode *node, nodeList) { |
| 123 |
appendBranchLockedNode(node); |
| 124 |
} |
| 125 |
return this; |
| 126 |
} |
| 127 |
|
| 128 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendBranchLockedNode(CHierarchyNode *branchNode) { |
| 129 |
if (!branchLockedNodeSet.contains(branchNode)) { |
| 130 |
branchLockedNodeSet.insert(branchNode); |
| 131 |
branchLockedNodeList.append(branchNode); |
| 132 |
} |
| 133 |
return this; |
| 134 |
} |
| 135 |
|
| 136 |
bool CNodeTopDownTraversalClassificationItem::hasDirectBranchLockedNode() { |
| 137 |
return parLockNode != 0; |
| 138 |
} |
| 139 |
|
| 140 |
CHierarchyNode *CNodeTopDownTraversalClassificationItem::getDirectBranchLockedNode() { |
| 141 |
return parLockNode; |
| 142 |
} |
| 143 |
|
| 144 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::setDirectBranchLockedNode(CHierarchyNode *parentLockedNode) { |
| 145 |
parLockNode = parentLockedNode; |
| 146 |
return this; |
| 147 |
} |
| 148 |
|
| 149 |
QList<CHierarchyNode *> *CNodeTopDownTraversalClassificationItem::getNewBranchNodeList() { |
| 150 |
return &newBranchNodeList; |
| 151 |
} |
| 152 |
|
| 153 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendNewBranchNodeList(QList<CHierarchyNode *> &nodeList) { |
| 154 |
newBranchNodeList << nodeList; |
| 155 |
return this; |
| 156 |
} |
| 157 |
|
| 158 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::appendNewBranchNode(CHierarchyNode *branchNode) { |
| 159 |
newBranchNodeList.append(branchNode); |
| 160 |
return this; |
| 161 |
} |
| 162 |
|
| 163 |
CHierarchyNode *CNodeTopDownTraversalClassificationItem::getEquivalentTestingNode() { |
| 164 |
return eqTestNode; |
| 165 |
} |
| 166 |
|
| 167 |
CNodeTopDownTraversalClassificationItem *CNodeTopDownTraversalClassificationItem::setEquivalentTestingNode(CHierarchyNode *equivalentTestingNode) { |
| 168 |
eqTestNode = equivalentTestingNode; |
| 169 |
return this; |
| 170 |
} |
| 171 |
|
| 172 |
CNodeTopDownTraversalClassificationItem* CNodeTopDownTraversalClassificationItem::setAlreadyTraversedDirectBlockedSuccessorNode(bool alredyTraversed) { |
| 173 |
alredyTraversedDirectBlockedSuccessorNode = alredyTraversed; |
| 174 |
return this; |
| 175 |
} |
| 176 |
|
| 177 |
bool CNodeTopDownTraversalClassificationItem::hasAlreadyTraversedDirectBlockedSuccessorNode() { |
| 178 |
return alredyTraversedDirectBlockedSuccessorNode; |
| 179 |
} |
| 180 |
|
| 181 |
|
| 182 |
}; // end namespace Classifier |
| 183 |
|
| 184 |
}; // end namespace Reasoner |
| 185 |
|
| 186 |
}; // end namespace Konclude |