Debian Codegraph @

Source/Reasoner/Kernel/Cache/CSaturationNodeAssociatedExpansionCacheEntry.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 "CSaturationNodeAssociatedExpansionCacheEntry.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Cache {
31
32
33 CSaturationNodeAssociatedExpansionCacheEntry::CSaturationNodeAssociatedExpansionCacheEntry(CSaturationNodeAssociatedExpansionCacheContext* context) : mContext(context) {
34 }
35
36
37 CSaturationNodeAssociatedExpansionCacheEntry* CSaturationNodeAssociatedExpansionCacheEntry::initCacheEntry(CIndividualSaturationProcessNode* saturationNode, cint64 remainingAllowedNonDetExpansionCount) {
38 mSaturationNode = saturationNode;
39 mNondetExpansionLinker = nullptr;
40 mDetExpansion = nullptr;
41 mRemainingAllowedNonDetExpansionCount = remainingAllowedNonDetExpansionCount;
42 return this;
43 }
44
45
46 CIndividualSaturationProcessNode* CSaturationNodeAssociatedExpansionCacheEntry::getSaturationIndividualNode() {
47 return mSaturationNode;
48 }
49
50
51 CSaturationNodeAssociatedDeterministicConceptExpansion* CSaturationNodeAssociatedExpansionCacheEntry::getDeterministicConceptExpansion() {
52 return mDetExpansion;
53 }
54
55 bool CSaturationNodeAssociatedExpansionCacheEntry::hasDeterministicConceptExpansion() {
56 return mDetExpansion != nullptr;
57 }
58
59
60 CSaturationNodeAssociatedNondeterministicConceptExpansion* CSaturationNodeAssociatedExpansionCacheEntry::getNondeterministicConceptExpansionLinker() {
61 return mNondetExpansionLinker;
62 }
63
64
65 CSaturationNodeAssociatedExpansionCacheEntry* CSaturationNodeAssociatedExpansionCacheEntry::setDeterministicConceptExpansion(CSaturationNodeAssociatedDeterministicConceptExpansion* detConceptExpansion) {
66 mDetExpansion = detConceptExpansion;
67 return this;
68 }
69
70 CSaturationNodeAssociatedExpansionCacheEntry* CSaturationNodeAssociatedExpansionCacheEntry::addNondeterministicConceptExpansion(CSaturationNodeAssociatedNondeterministicConceptExpansion* nondetConceptExpansion) {
71 mNondetExpansionLinker = nondetConceptExpansion->append(mNondetExpansionLinker);
72 return this;
73 }
74
75
76 cint64 CSaturationNodeAssociatedExpansionCacheEntry::getRemainingAllowedNondeterministicExpansionCount() {
77 return mRemainingAllowedNonDetExpansionCount;
78 }
79
80
81 bool CSaturationNodeAssociatedExpansionCacheEntry::areMoreNondeterministicExpansionAllowed() {
82 return mRemainingAllowedNonDetExpansionCount > 0;
83 }
84
85 CSaturationNodeAssociatedExpansionCacheEntry* CSaturationNodeAssociatedExpansionCacheEntry::decRemainingAllowedNondeterministicExpansionCount(cint64 decCount) {
86 if (mRemainingAllowedNonDetExpansionCount > 0) {
87 mRemainingAllowedNonDetExpansionCount -= decCount;
88 }
89 return this;
90 }
91
92
93 }; // end namespace Cache
94
95 }; // end namespace Kernel
96
97 }; // end namespace Reasoner
98
99 }; // end namespace Konclude