Debian Codegraph @

Source/Reasoner/Kernel/Process/Dependency/CBranchTreeNode.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 "CBranchTreeNode.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Process {
31
32 namespace Dependency {
33
34
35 CBranchTreeNode::CBranchTreeNode(CProcessContext* processContext) {
36 mProcessContext = processContext;
37 mBranchedDepTrackPoint = nullptr;
38 mSatCalcTask = nullptr;
39
40 KONCLUCE_TASK_ALGORITHM_BRANCH_STRING_INSTRUCTION(mBranchString = nullptr);
41 }
42
43 CBranchTreeNode* CBranchTreeNode::initBranchingRootNode(Task::CSatisfiableCalculationTask* satCalcTask) {
44 mParentNode = nullptr;
45 mRootNode = this;
46 initBranchingTag((cint64)0);
47 mSatCalcTask = satCalcTask;
48 return this;
49 }
50
51
52 CBranchTreeNode* CBranchTreeNode::initBranchingChildNode(CBranchTreeNode* parentBranchTreeNode, Task::CSatisfiableCalculationTask* satCalcTask) {
53 mSatCalcTask = satCalcTask;
54 mBranchedDepTrackPoint = nullptr;
55 mParentNode = parentBranchTreeNode;
56 mRootNode = nullptr;
57 initBranchingTag((cint64)0);
58 if (parentBranchTreeNode) {
59 mRootNode = parentBranchTreeNode->mRootNode;
60 setBranchingTag(parentBranchTreeNode->getBranchingLevel());
61 }
62 return this;
63 }
64
65
66 CBranchTreeNode* CBranchTreeNode::branchingIncrement(CNonDeterministicDependencyTrackPoint* depTrackPoint) {
67 incBranchingTag();
68 mBranchedDepTrackPoint = depTrackPoint;
69 return this;
70 }
71
72
73 CNonDeterministicDependencyTrackPoint* CBranchTreeNode::getDependencyTrackPoint() {
74 return mBranchedDepTrackPoint;
75 }
76
77
78
79 CBranchTreeNode* CBranchTreeNode::initBranchingCopyNode(CBranchTreeNode* copyBranchTreeNode, Task::CSatisfiableCalculationTask* satCalcTask) {
80 mSatCalcTask = satCalcTask;
81 mBranchedDepTrackPoint = copyBranchTreeNode->mBranchedDepTrackPoint;
82 mParentNode = copyBranchTreeNode->mParentNode;
83 mRootNode = copyBranchTreeNode->mRootNode;
84 setBranchingTag(copyBranchTreeNode->getBranchingLevel());
85 if (copyBranchTreeNode->isRootNode()) {
86 mRootNode = this;
87 }
88 return this;
89 }
90
91
92 CBranchTreeNode* CBranchTreeNode::getParentNode() {
93 return mParentNode;
94 }
95
96 CBranchTreeNode* CBranchTreeNode::getRootNode() {
97 return mRootNode;
98 }
99
100 bool CBranchTreeNode::isRootNode() {
101 return mRootNode == this;
102 }
103
104
105 cint64 CBranchTreeNode::getBranchingLevel() {
106 return getBranchingTag();
107 }
108
109
110 Task::CSatisfiableCalculationTask* CBranchTreeNode::getSatisfiableCalculationTask() {
111 return mSatCalcTask;
112 }
113
114 KONCLUCE_TASK_ALGORITHM_BRANCH_STRING_INSTRUCTION(CBranchTreeNode* CBranchTreeNode::setBranchString(QString* string) {\
115 mBranchString = string;\
116 return this;\
117 })
118
119 }; // end namespace Dependency
120
121 }; // end namespace Process
122
123 }; // end namespace Kernel
124
125 }; // end namespace Reasoner
126
127 }; // end namespace Konclude