Debian Codegraph @

Source/Reasoner/Classifier/CNodeBottomUpTraversalClassificationItem.cpp

raw
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 "CNodeBottomUpTraversalClassificationItem.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Classifier {
29
30
31 CNodeBottomUpTraversalClassificationItem::CNodeBottomUpTraversalClassificationItem(CHierarchyNode *node, QList<CHierarchyNode *> &branchNodes, QList<CNodeBottomUpTraversalClassificationItem *> *lockedReleaseProcessingList) {
32 traversalNode = node;
33 lockedReleaseProcList = lockedReleaseProcessingList;
34 testNode = 0;
35 parLockNode = 0;
36 subSumTestingResult = false;
37 allSilbingBranchTested = false;
38 branchLockedNodeList << branchNodes;
39 foreach (CHierarchyNode* node, branchNodes) {
40 newBranchNodeSet.insert(node);
41 }
42
43 silbingBranchTestNodeCount = branchLockedNodeList.count();
44 mChildNodeAdded = false;
45 }
46
47
48 CNodeBottomUpTraversalClassificationItem::~CNodeBottomUpTraversalClassificationItem() {
49 }
50
51
52
53 CNodeBlockedClassificationItem *CNodeBottomUpTraversalClassificationItem::releaseBlockedResumeProcessing() {
54 lockedReleaseProcList->append(this);
55 return this;
56 }
57
58 CNodeBlockedClassificationItem *CNodeBottomUpTraversalClassificationItem::releaseTestingBlockedResumeProcessing(CConcept *subsumerConcept, CConcept *subsumedConcept, bool testingResult) {
59 subSumTestingResult = testingResult;
60 lockedReleaseProcList->append(this);
61 return this;
62 }
63
64
65
66 CHierarchyNode *CNodeBottomUpTraversalClassificationItem::getTraversalNode() {
67 return traversalNode;
68 }
69
70 QList<CHierarchyNode *> *CNodeBottomUpTraversalClassificationItem::getTestingNodeList() {
71 return &testingNodeList;
72 }
73
74 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::appendTestingNodeList(QList<CHierarchyNode *> &nodeList) {
75 testingNodeList << nodeList;
76 return this;
77 }
78
79 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::appendTestingNode(CHierarchyNode *node) {
80 testingNodeList.append(node);
81 return this;
82 }
83
84
85 QList<CHierarchyNode *> *CNodeBottomUpTraversalClassificationItem::getChildNodeList() {
86 return &childNodeList;
87 }
88
89 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::appendChildNodeList(QList<CHierarchyNode *> &nodeList) {
90 childNodeList << nodeList;
91 return this;
92 }
93
94 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::appendChildNode(CHierarchyNode *node) {
95 childNodeList.append(node);
96 return this;
97 }
98
99 bool CNodeBottomUpTraversalClassificationItem::hasNextTestingNode() {
100 return !testingNodeList.isEmpty();
101 }
102
103 CHierarchyNode *CNodeBottomUpTraversalClassificationItem::takeNextTestingNode() {
104 testNode = testingNodeList.takeFirst();
105 return testNode;
106 }
107
108 CHierarchyNode *CNodeBottomUpTraversalClassificationItem::getTestingNode() {
109 return testNode;
110 }
111
112 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::clearTestingNode() {
113 testNode = 0;
114 return this;
115 }
116
117 bool CNodeBottomUpTraversalClassificationItem::getTestingResult() {
118 return subSumTestingResult;
119 }
120
121
122 QList<CHierarchyNode *> *CNodeBottomUpTraversalClassificationItem::getBranchLockedNodeList() {
123 return &branchLockedNodeList;
124 }
125
126 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::appendBranchLockedNodeList(QList<CHierarchyNode *> &nodeList) {
127 branchLockedNodeList << nodeList;
128 return this;
129 }
130
131 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::appendBranchLockedNode(CHierarchyNode *branchNode) {
132 branchLockedNodeList.append(branchNode);
133 return this;
134 }
135
136 bool CNodeBottomUpTraversalClassificationItem::hasDirectBranchLockedNode() {
137 return parLockNode != 0;
138 }
139
140 CHierarchyNode *CNodeBottomUpTraversalClassificationItem::getDirectBranchLockedNode() {
141 return parLockNode;
142 }
143
144 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::setDirectBranchLockedNode(CHierarchyNode *parentLockedNode) {
145 parLockNode = parentLockedNode;
146 return this;
147 }
148
149 QList<CHierarchyNode *> *CNodeBottomUpTraversalClassificationItem::getNewBranchNodeList() {
150 return &newBranchNodeList;
151 }
152
153 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::appendNewBranchNodeList(QList<CHierarchyNode *> &nodeList) {
154 foreach (CHierarchyNode* node, nodeList) {
155 appendNewBranchNode(node);
156 }
157 return this;
158 }
159
160 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::appendNewBranchNode(CHierarchyNode *branchNode) {
161 if (!newBranchNodeSet.contains(branchNode)) {
162 newBranchNodeList.append(branchNode);
163 newBranchNodeSet.insert(branchNode);
164 }
165 return this;
166 }
167
168
169 bool CNodeBottomUpTraversalClassificationItem::hasAllSilbingBranchTested() {
170 return allSilbingBranchTested;
171 }
172
173 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::setAllSilbingBranchTested(bool allSilbingsTested) {
174 allSilbingBranchTested = allSilbingsTested;
175 return this;
176 }
177
178 qint64 CNodeBottomUpTraversalClassificationItem::getSilbingBranchTestNodeCount() {
179 return silbingBranchTestNodeCount;
180 }
181
182 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::decSilbingBranchTestNodeCount() {
183 --silbingBranchTestNodeCount;
184 return this;
185 }
186
187
188 bool CNodeBottomUpTraversalClassificationItem::isChildNodeAddedContinueBlocking() {
189 return mChildNodeAdded;
190 }
191
192 CNodeBottomUpTraversalClassificationItem *CNodeBottomUpTraversalClassificationItem::setChildNodeAddedContinueBlocking(bool addedChildNode) {
193 mChildNodeAdded = addedChildNode;
194 return this;
195 }
196
197 QList<CHierarchyNode*> CNodeBottomUpTraversalClassificationItem::getChildNodeAddedContinueBlockingList() {
198 return childNodeContinueBlockingList;
199 }
200
201 CNodeBottomUpTraversalClassificationItem* CNodeBottomUpTraversalClassificationItem::addChildNodeAddedContinueBlocking(CHierarchyNode* continueBlocking) {
202 childNodeContinueBlockingList.append(continueBlocking);
203 return this;
204 }
205
206
207 }; // end namespace Classifier
208
209 }; // end namespace Reasoner
210
211 }; // end namespace Konclude