Debian Codegraph @

Source/Reasoner/Realizer/COptimizedKPSetRoleNeighbourInstancesHashData.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 "COptimizedKPSetRoleNeighbourInstancesHashData.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Realizer {
29
30
31 COptimizedKPSetRoleNeighbourInstancesHashData::COptimizedKPSetRoleNeighbourInstancesHashData() {
32 mRoleSuccessorInstancesHash = nullptr;
33 mRolePredecessorInstancesHash = nullptr;
34
35 mRoleSuccessorInstancesInitialized = false;
36 mRolePredecessorInstancesInitialized = false;
37
38 mRoleSuccessorInstancesInitializing = false;
39 mRolePredecessorInstancesInitializing = false;
40 }
41
42
43 COptimizedKPSetRoleInstancesHash* COptimizedKPSetRoleNeighbourInstancesHashData::getRoleSuccessorInstancesHash(bool forceCreated) {
44 if (forceCreated && !mRoleSuccessorInstancesHash) {
45 mRoleSuccessorInstancesHash = new COptimizedKPSetRoleInstancesHash();
46 }
47 return mRoleSuccessorInstancesHash;
48 }
49
50 COptimizedKPSetRoleInstancesHash* COptimizedKPSetRoleNeighbourInstancesHashData::getRolePredecessorInstancesHash(bool forceCreated) {
51 if (forceCreated && !mRolePredecessorInstancesHash) {
52 mRolePredecessorInstancesHash = new COptimizedKPSetRoleInstancesHash();
53 }
54 return mRolePredecessorInstancesHash;
55 }
56
57
58 COptimizedKPSetRoleInstancesHash* COptimizedKPSetRoleNeighbourInstancesHashData::getRoleNeighbourInstancesHash(bool inversed, bool forceCreated) {
59 if (inversed) {
60 return getRolePredecessorInstancesHash(forceCreated);
61 } else {
62 return getRoleSuccessorInstancesHash(forceCreated);
63 }
64 }
65
66
67 COptimizedKPSetRoleInstancesData* COptimizedKPSetRoleNeighbourInstancesHashData::getRoleSuccessorInstanceItemData(COptimizedKPSetIndividualItem* item) {
68 if (mRoleSuccessorInstancesHash) {
69 return mRoleSuccessorInstancesHash->getInstanceItemData(item);
70 }
71 return nullptr;
72 }
73
74 COptimizedKPSetRoleInstancesData* COptimizedKPSetRoleNeighbourInstancesHashData::getRolePredecessorInstanceItemData(COptimizedKPSetIndividualItem* item) {
75 if (mRolePredecessorInstancesHash) {
76 return mRolePredecessorInstancesHash->getInstanceItemData(item);
77 }
78 return nullptr;
79 }
80
81
82 COptimizedKPSetRoleInstancesData* COptimizedKPSetRoleNeighbourInstancesHashData::getRoleSuccessorInstanceItemData(cint64 indiId, bool forceCreated) {
83 if (getRoleSuccessorInstancesHash(forceCreated)) {
84 return mRoleSuccessorInstancesHash->getInstanceItemData(indiId, forceCreated);
85 }
86 return nullptr;
87 }
88
89 COptimizedKPSetRoleInstancesData* COptimizedKPSetRoleNeighbourInstancesHashData::getRolePredecessorInstanceItemData(cint64 indiId, bool forceCreated) {
90 if (getRolePredecessorInstancesHash(forceCreated)) {
91 return mRolePredecessorInstancesHash->getInstanceItemData(indiId, forceCreated);
92 }
93 return nullptr;
94 }
95
96
97 COptimizedKPSetRoleInstancesData* COptimizedKPSetRoleNeighbourInstancesHashData::getRoleNeighbourInstanceItemData(bool inversed, cint64 indiId, bool forceCreated) {
98 if (!inversed) {
99 return getRoleSuccessorInstanceItemData(indiId, forceCreated);
100 } else {
101 return getRolePredecessorInstanceItemData(indiId, forceCreated);
102 }
103 }
104
105 }; // end namespace Realizer
106
107 }; // end namespace Reasoner
108
109 }; // end namespace Konclude