| 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 "CBackendRepresentativeMemoryCacheIndividualAssociationData.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Kernel { |
| 29 |
|
| 30 |
namespace Cache { |
| 31 |
|
| 32 |
|
| 33 |
CBackendRepresentativeMemoryCacheIndividualAssociationData::CBackendRepresentativeMemoryCacheIndividualAssociationData() { |
| 34 |
mMemContext = nullptr; |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::initAssociationData(CBackendRepresentativeMemoryCacheIndividualAssociationData* assData, bool increaseUpdateId) { |
| 40 |
initCachingStatusFlags(assData->getStatusFlags()); |
| 41 |
mIndiID = assData->mIndiID; |
| 42 |
mRepresentativeSameIndiId = assData->mRepresentativeSameIndiId; |
| 43 |
mDeterministicSameIndiId = assData->mDeterministicSameIndiId; |
| 44 |
mIncompletelyMarked = assData->mIncompletelyMarked; |
| 45 |
mIndirectlyConnectedNominalIndividual = assData->mIndirectlyConnectedNominalIndividual; |
| 46 |
mIndirectlyConnectedIndividualIntegration = assData->mIndirectlyConnectedIndividualIntegration; |
| 47 |
mCardinalityCacheEntry = assData->mCardinalityCacheEntry; |
| 48 |
for (cint64 i = 0; i < CBackendRepresentativeMemoryLabelCacheItem::LABEL_CACHE_ITEM_ASSOCIATABLE_TYPE_COUNT; ++i) { |
| 49 |
mLabelCacheEntries[i] = assData->mLabelCacheEntries[i]; |
| 50 |
} |
| 51 |
mNeighbourRoleSetHash = nullptr; |
| 52 |
mRoleSetNeighbourArray = nullptr; |
| 53 |
mAssociationDataUpdateId = assData->mAssociationDataUpdateId; |
| 54 |
if (increaseUpdateId) { |
| 55 |
mAssociationDataUpdateId++; |
| 56 |
} |
| 57 |
mProblematicLevel = assData->mProblematicLevel; |
| 58 |
mCacheUpdateId = 0; |
| 59 |
mCacheTouchId = 0; |
| 60 |
mLastIntegratedIndirectlyConnectedIndividualsChangeId = assData->mLastIntegratedIndirectlyConnectedIndividualsChangeId; |
| 61 |
mPrevData = assData; |
| 62 |
mProblematicLeveledNeighbour = assData->mProblematicLeveledNeighbour; |
| 63 |
mDetMergedSameConsideredLabelCacheEntry = assData->mDetMergedSameConsideredLabelCacheEntry; |
| 64 |
#ifndef KONCLUDE_FORCE_ALL_DEBUG_DEACTIVATED |
| 65 |
mDebugIndi = assData->mDebugIndi; |
| 66 |
#endif |
| 67 |
mLastPropagationCuttingUpdateId = assData->mLastPropagationCuttingUpdateId; |
| 68 |
mPropCutRemovedNeighbourIndiLinker = assData->mPropCutRemovedNeighbourIndiLinker; |
| 69 |
return this; |
| 70 |
} |
| 71 |
|
| 72 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::initAssociationData(cint64 indiId) { |
| 73 |
initCachingStatusFlags(); |
| 74 |
mAssociationDataUpdateId = 1; |
| 75 |
mIndiID = indiId; |
| 76 |
mRepresentativeSameIndiId = indiId; |
| 77 |
mDeterministicSameIndiId = indiId; |
| 78 |
mIncompletelyMarked = false; |
| 79 |
mIndirectlyConnectedNominalIndividual = false; |
| 80 |
mIndirectlyConnectedIndividualIntegration = false; |
| 81 |
mCardinalityCacheEntry = nullptr; |
| 82 |
for (cint64 i = 0; i < CBackendRepresentativeMemoryLabelCacheItem::LABEL_CACHE_ITEM_ASSOCIATABLE_TYPE_COUNT; ++i) { |
| 83 |
mLabelCacheEntries[i] = nullptr; |
| 84 |
} |
| 85 |
mNeighbourRoleSetHash = nullptr; |
| 86 |
mRoleSetNeighbourArray = nullptr; |
| 87 |
mProblematicLevel = 0; |
| 88 |
mCacheUpdateId = 0; |
| 89 |
mCacheTouchId = 0; |
| 90 |
mLastIntegratedIndirectlyConnectedIndividualsChangeId = 0; |
| 91 |
mProblematicLeveledNeighbour = false; |
| 92 |
mDetMergedSameConsideredLabelCacheEntry = nullptr; |
| 93 |
mPropCutRemovedNeighbourIndiLinker = nullptr; |
| 94 |
#ifndef KONCLUDE_FORCE_ALL_DEBUG_DEACTIVATED |
| 95 |
mDebugIndi = nullptr; |
| 96 |
#endif |
| 97 |
mLastPropagationCuttingUpdateId = -1; |
| 98 |
return this; |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setIndividualId(cint64 indiId) { |
| 103 |
mIndiID = indiId; |
| 104 |
return this; |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
CBackendRepresentativeMemoryLabelCacheItem* CBackendRepresentativeMemoryCacheIndividualAssociationData::getDeterministicConceptSetLabelCacheEntry() { |
| 109 |
return getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_CONCEPT_SET_LABEL); |
| 110 |
} |
| 111 |
|
| 112 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setDeterministicConceptSetLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem* cacheEntry) { |
| 113 |
setLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_CONCEPT_SET_LABEL, cacheEntry); |
| 114 |
return this; |
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
CBackendRepresentativeMemoryLabelCacheItem* CBackendRepresentativeMemoryCacheIndividualAssociationData::getDeterministicMergedSameConsideredLabelCacheEntry() { |
| 120 |
return mDetMergedSameConsideredLabelCacheEntry; |
| 121 |
} |
| 122 |
|
| 123 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setDeterministicMergedSameConsideredLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem* cacheEntry) { |
| 124 |
mDetMergedSameConsideredLabelCacheEntry = cacheEntry; |
| 125 |
return this; |
| 126 |
} |
| 127 |
|
| 128 |
|
| 129 |
CBackendRepresentativeMemoryLabelCacheItem* CBackendRepresentativeMemoryCacheIndividualAssociationData::getLabelCacheEntry(cint64 labelType) { |
| 130 |
return mLabelCacheEntries[labelType]; |
| 131 |
} |
| 132 |
|
| 133 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setLabelCacheEntry(cint64 labelType, CBackendRepresentativeMemoryLabelCacheItem* cacheEntry) { |
| 134 |
mLabelCacheEntries[labelType] = cacheEntry; |
| 135 |
return this; |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
CBackendRepresentativeMemoryCardinalityCacheItem* CBackendRepresentativeMemoryCacheIndividualAssociationData::getBackendCardinalityCacheEntry() { |
| 140 |
return mCardinalityCacheEntry; |
| 141 |
} |
| 142 |
|
| 143 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setBackendCardinalityCacheEntry(CBackendRepresentativeMemoryCardinalityCacheItem* cacheEntry) { |
| 144 |
mCardinalityCacheEntry = cacheEntry; |
| 145 |
return this; |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
bool CBackendRepresentativeMemoryCacheIndividualAssociationData::isIncompletelyMarked() { |
| 150 |
return mIncompletelyMarked; |
| 151 |
} |
| 152 |
|
| 153 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setIncompletelyMarked(bool marked) { |
| 154 |
mIncompletelyMarked = marked; |
| 155 |
return this; |
| 156 |
} |
| 157 |
|
| 158 |
|
| 159 |
CBackendRepresentativeMemoryCacheIndividualNeighbourRoleSetHash* CBackendRepresentativeMemoryCacheIndividualAssociationData::getNeighbourRoleSetHash() { |
| 160 |
return mNeighbourRoleSetHash; |
| 161 |
} |
| 162 |
|
| 163 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setNeighbourRoleSetHash(CBackendRepresentativeMemoryCacheIndividualNeighbourRoleSetHash* neighbourRoleSetHash) { |
| 164 |
mNeighbourRoleSetHash = neighbourRoleSetHash; |
| 165 |
return this; |
| 166 |
} |
| 167 |
|
| 168 |
|
| 169 |
CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* CBackendRepresentativeMemoryCacheIndividualAssociationData::getRoleSetNeighbourArray() { |
| 170 |
return mRoleSetNeighbourArray; |
| 171 |
} |
| 172 |
|
| 173 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setRoleSetNeighbourArray(CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourArray* roleSetNeighbourArray) { |
| 174 |
mRoleSetNeighbourArray = roleSetNeighbourArray; |
| 175 |
return this; |
| 176 |
} |
| 177 |
|
| 178 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getAssociationDataUpdateId() { |
| 179 |
return mAssociationDataUpdateId; |
| 180 |
} |
| 181 |
|
| 182 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getCacheUpdateId() { |
| 183 |
return mCacheUpdateId; |
| 184 |
} |
| 185 |
|
| 186 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getCacheTouchId() { |
| 187 |
return mCacheTouchId; |
| 188 |
} |
| 189 |
|
| 190 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setCacheUpdateId(cint64 updateId) { |
| 191 |
mCacheUpdateId = updateId; |
| 192 |
mCacheTouchId = updateId; |
| 193 |
return this; |
| 194 |
} |
| 195 |
|
| 196 |
|
| 197 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setCacheTouchId(cint64 updateId) { |
| 198 |
mCacheTouchId = updateId; |
| 199 |
return this; |
| 200 |
} |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getLastIntegratedIndirectlyConnectedIndividualsChangeId() { |
| 205 |
return mLastIntegratedIndirectlyConnectedIndividualsChangeId; |
| 206 |
} |
| 207 |
|
| 208 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setLastIntegratedIndirectlyConnectedIndividualsChangeId(cint64 lastIntegratedChangeId) { |
| 209 |
mLastIntegratedIndirectlyConnectedIndividualsChangeId = lastIntegratedChangeId; |
| 210 |
return this; |
| 211 |
} |
| 212 |
|
| 213 |
|
| 214 |
bool CBackendRepresentativeMemoryCacheIndividualAssociationData::isIndirectlyConnectedNominalIndividual() { |
| 215 |
return mIndirectlyConnectedNominalIndividual; |
| 216 |
} |
| 217 |
|
| 218 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setIndirectlyConnectedNominalIndividual(bool indirectlyConnected) { |
| 219 |
mIndirectlyConnectedNominalIndividual = indirectlyConnected; |
| 220 |
return this; |
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
bool CBackendRepresentativeMemoryCacheIndividualAssociationData::hasIndirectlyConnectedIndividualIntegration() { |
| 225 |
return mIndirectlyConnectedIndividualIntegration; |
| 226 |
} |
| 227 |
|
| 228 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setIndirectlyConnectedIndividualIntegration(bool indirectlyConnectedIndividualIntegration) { |
| 229 |
mIndirectlyConnectedIndividualIntegration = indirectlyConnectedIndividualIntegration; |
| 230 |
return this; |
| 231 |
} |
| 232 |
|
| 233 |
|
| 234 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getRepresentativeSameIndividualId() { |
| 235 |
return mRepresentativeSameIndiId; |
| 236 |
} |
| 237 |
|
| 238 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setRepresentativeSameIndividualId(cint64 indiId) { |
| 239 |
mRepresentativeSameIndiId = indiId; |
| 240 |
return this; |
| 241 |
} |
| 242 |
|
| 243 |
|
| 244 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::hasRepresentativeSameIndividualMerging() { |
| 245 |
return mIndiID != mRepresentativeSameIndiId; |
| 246 |
} |
| 247 |
|
| 248 |
|
| 249 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getDeterministicSameIndividualId() { |
| 250 |
return mDeterministicSameIndiId; |
| 251 |
} |
| 252 |
|
| 253 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setDeterministicSameIndividualId(cint64 indiId) { |
| 254 |
mDeterministicSameIndiId = indiId; |
| 255 |
return this; |
| 256 |
} |
| 257 |
|
| 258 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::hasDeterministicSameIndividualMerging() { |
| 259 |
return mIndiID != mDeterministicSameIndiId; |
| 260 |
} |
| 261 |
|
| 262 |
|
| 263 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getAssociatedIndividualId() { |
| 264 |
return mIndiID; |
| 265 |
} |
| 266 |
|
| 267 |
|
| 268 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::hasProblematicLevel() { |
| 269 |
return mProblematicLevel > 0; |
| 270 |
} |
| 271 |
|
| 272 |
|
| 273 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getProblematicLevel() { |
| 274 |
return mProblematicLevel; |
| 275 |
} |
| 276 |
|
| 277 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setProblematicLevel(cint64 level) { |
| 278 |
mProblematicLevel = level; |
| 279 |
return this; |
| 280 |
} |
| 281 |
|
| 282 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::incProblematicLevel(cint64 count) { |
| 283 |
mProblematicLevel += count; |
| 284 |
return this; |
| 285 |
} |
| 286 |
|
| 287 |
|
| 288 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::hasProblematicLeveledNeigbour() { |
| 289 |
return mProblematicLeveledNeighbour; |
| 290 |
} |
| 291 |
|
| 292 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setProblematicLeveledNeigbour(bool neighbourPropLeveled) { |
| 293 |
mProblematicLeveledNeighbour = neighbourPropLeveled; |
| 294 |
return this; |
| 295 |
} |
| 296 |
|
| 297 |
|
| 298 |
CBackendRepresentativeMemoryCacheIndividualAssociationContext* CBackendRepresentativeMemoryCacheIndividualAssociationData::getIndividualAssociationMemoryContext() { |
| 299 |
return mMemContext; |
| 300 |
} |
| 301 |
|
| 302 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setIndividualAssociationMemoryContext(CBackendRepresentativeMemoryCacheIndividualAssociationContext* memCon) { |
| 303 |
mMemContext = memCon; |
| 304 |
return this; |
| 305 |
} |
| 306 |
|
| 307 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setLastPropagationCuttingUpdateId(cint64 id) { |
| 308 |
mLastPropagationCuttingUpdateId = id; |
| 309 |
return this; |
| 310 |
} |
| 311 |
|
| 312 |
cint64 CBackendRepresentativeMemoryCacheIndividualAssociationData::getLastPropagationCuttingUpdateId() { |
| 313 |
return mLastPropagationCuttingUpdateId; |
| 314 |
} |
| 315 |
|
| 316 |
bool CBackendRepresentativeMemoryCacheIndividualAssociationData::hasLastPropagationCuttingUpdateId() { |
| 317 |
return mLastPropagationCuttingUpdateId != -1; |
| 318 |
} |
| 319 |
|
| 320 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::getPreviousData() { |
| 321 |
return mPrevData; |
| 322 |
} |
| 323 |
|
| 324 |
|
| 325 |
CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourIndividualIdLinker* CBackendRepresentativeMemoryCacheIndividualAssociationData::getPropagationCutRemovedNeighbourIndividualLinker() { |
| 326 |
return mPropCutRemovedNeighbourIndiLinker; |
| 327 |
} |
| 328 |
|
| 329 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* CBackendRepresentativeMemoryCacheIndividualAssociationData::setPropagationCutRemovedNeighbourIndividualLinker(CBackendRepresentativeMemoryCacheIndividualRoleSetNeighbourIndividualIdLinker* linker) { |
| 330 |
mPropCutRemovedNeighbourIndiLinker = linker; |
| 331 |
return this; |
| 332 |
} |
| 333 |
|
| 334 |
|
| 335 |
}; // end namespace Cache |
| 336 |
|
| 337 |
}; // end namespace Kernel |
| 338 |
|
| 339 |
}; // end namespace Reasoner |
| 340 |
|
| 341 |
}; // end namespace Konclude |