| 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 "CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Kernel { |
| 29 |
|
| 30 |
namespace Cache { |
| 31 |
|
| 32 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker() : CLinkerBase<CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker*, CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker>(this) { |
| 33 |
} |
| 34 |
|
| 35 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::initAccociationWriteData(CIndividual* individual, UPDATE_TYPE labelUpdateType, UPDATE_TYPE linksUpdateType) { |
| 36 |
initAccociationWriteData(individual->getIndividualID(), labelUpdateType, linksUpdateType); |
| 37 |
mIndividual = individual; |
| 38 |
return this; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::initAccociationWriteData(cint64 indiID, UPDATE_TYPE labelUpdateType, UPDATE_TYPE linksUpdateType) { |
| 43 |
initCachingStatusFlags(CBackendRepresentativeMemoryCachingFlags::FLAG_COMPLETELY_HANDLED | CBackendRepresentativeMemoryCachingFlags::FLAG_COMPLETELY_SATURATED); |
| 44 |
mLabelUpdateType = labelUpdateType; |
| 45 |
mLinksUpdateType = linksUpdateType; |
| 46 |
mIndividual = nullptr; |
| 47 |
mIndividualID = indiID; |
| 48 |
for (cint64 i = 0; i < CBackendRepresentativeMemoryLabelCacheItem::LABEL_CACHE_ITEM_ASSOCIATABLE_TYPE_COUNT; ++i) { |
| 49 |
mReferredLabelData[i] = nullptr; |
| 50 |
mReferredTmpLabelData[i] = nullptr; |
| 51 |
} |
| 52 |
mReferredTmpCardData = nullptr; |
| 53 |
mReferredCardData = nullptr; |
| 54 |
mRoleSetNeighbourUpdateDataLinker = nullptr; |
| 55 |
mAssociationUpdateId = 0; |
| 56 |
mIntegratedIndirectlyConnectedIndividualsChangeId = 0; |
| 57 |
mRepresentativeSameIndiId = mIndividualID; |
| 58 |
mDeterministicSameIndiId = mIndividualID; |
| 59 |
mIndirectlyConnectedNominalIndividual = false; |
| 60 |
mIndirectlyConnectedIndividualIntegration = false; |
| 61 |
mRequireSameAsNeighboursCompletion = false; |
| 62 |
mScheduledIndividual = false; |
| 63 |
return this; |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setReferredLabel(cint64 labelType, CBackendRepresentativeMemoryCacheTemporaryLabelReference& labelRef) { |
| 68 |
if (labelRef.getReferredLabelData()) { |
| 69 |
setReferredLabelData(labelType, labelRef.getReferredLabelData()); |
| 70 |
} else { |
| 71 |
setReferredTemporaryLabelData(labelType, labelRef.getReferredTemporaryLabelData()); |
| 72 |
} |
| 73 |
return this; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setReferredTemporaryLabelData(cint64 labelType, CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker* referredTmpLabelData) { |
| 78 |
if (labelType == CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_COMBINED_EXISTENTIAL_INSTANTIATED_ROLE_SET_LABEL && referredTmpLabelData && referredTmpLabelData->getLabelType() != CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_COMBINED_EXISTENTIAL_INSTANTIATED_ROLE_SET_LABEL) { |
| 79 |
bool debug = true; |
| 80 |
} |
| 81 |
mReferredTmpLabelData[labelType] = referredTmpLabelData; |
| 82 |
return this; |
| 83 |
} |
| 84 |
|
| 85 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setReferredLabelData(cint64 labelType, CBackendRepresentativeMemoryLabelCacheItem* referredLabelData) { |
| 86 |
if (labelType == CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_COMBINED_EXISTENTIAL_INSTANTIATED_ROLE_SET_LABEL && referredLabelData && referredLabelData->getLabelType() != CBackendRepresentativeMemoryLabelCacheItem::DETERMINISTIC_COMBINED_EXISTENTIAL_INSTANTIATED_ROLE_SET_LABEL) { |
| 87 |
bool debug = true; |
| 88 |
} |
| 89 |
mReferredLabelData[labelType] = referredLabelData; |
| 90 |
return this; |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setReferredTemporaryCardinalityData(CBackendRepresentativeMemoryCacheTemporaryCardinalityWriteDataLinker* referredTmpCardData) { |
| 95 |
mReferredTmpCardData = referredTmpCardData; |
| 96 |
return this; |
| 97 |
} |
| 98 |
|
| 99 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setReferredCardinalityData(CBackendRepresentativeMemoryCardinalityCacheItem* referredCardData) { |
| 100 |
mReferredCardData = referredCardData; |
| 101 |
return this; |
| 102 |
} |
| 103 |
|
| 104 |
CBackendRepresentativeMemoryCacheTemporaryCardinalityWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getReferredTemporaryCardinalityData() { |
| 105 |
return mReferredTmpCardData; |
| 106 |
} |
| 107 |
|
| 108 |
|
| 109 |
CBackendRepresentativeMemoryCardinalityCacheItem* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getReferredCardinalityData() { |
| 110 |
return mReferredCardData; |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
CIndividual* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getIndividual() { |
| 116 |
return mIndividual; |
| 117 |
} |
| 118 |
|
| 119 |
cint64 CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getIndividualID() { |
| 120 |
return mIndividualID; |
| 121 |
} |
| 122 |
|
| 123 |
|
| 124 |
CBackendRepresentativeMemoryCacheTemporaryLabelWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getReferredTemporaryLabelData(cint64 labelType) { |
| 125 |
return mReferredTmpLabelData[labelType]; |
| 126 |
} |
| 127 |
|
| 128 |
CBackendRepresentativeMemoryLabelCacheItem* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getReferredLabelData(cint64 labelType) { |
| 129 |
return mReferredLabelData[labelType]; |
| 130 |
} |
| 131 |
|
| 132 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::UPDATE_TYPE CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getLabelUpdateType() { |
| 133 |
return mLabelUpdateType; |
| 134 |
} |
| 135 |
|
| 136 |
|
| 137 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::UPDATE_TYPE CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getLinksUpdateType() { |
| 138 |
return mLinksUpdateType; |
| 139 |
} |
| 140 |
|
| 141 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setLinksUpdateType(UPDATE_TYPE updateType) { |
| 142 |
mLinksUpdateType = updateType; |
| 143 |
return this; |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
CBackendRepresentativeMemoryCacheTemporaryIndividualRoleSetNeighbourUpdateDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getRoleSetNeighbourUpdateDataLinker() { |
| 148 |
return mRoleSetNeighbourUpdateDataLinker; |
| 149 |
} |
| 150 |
|
| 151 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setRoleSetNeighbourUpdateDataLinker(CBackendRepresentativeMemoryCacheTemporaryIndividualRoleSetNeighbourUpdateDataLinker* roleSetNeighbourUpdateDataLinker) { |
| 152 |
mRoleSetNeighbourUpdateDataLinker = roleSetNeighbourUpdateDataLinker; |
| 153 |
return this; |
| 154 |
} |
| 155 |
|
| 156 |
|
| 157 |
cint64 CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getUsedAssociationUpdateId() { |
| 158 |
return mAssociationUpdateId; |
| 159 |
} |
| 160 |
|
| 161 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setUsedAssociationUpdateId(cint64 id) { |
| 162 |
mAssociationUpdateId = id; |
| 163 |
return this; |
| 164 |
} |
| 165 |
|
| 166 |
cint64 CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getIntegratedIndirectlyConnectedIndividualsChangeId() { |
| 167 |
return mIntegratedIndirectlyConnectedIndividualsChangeId; |
| 168 |
} |
| 169 |
|
| 170 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setIntegratedIndirectlyConnectedIndividualsChangeId(cint64 integratedChangeId) { |
| 171 |
mIntegratedIndirectlyConnectedIndividualsChangeId = integratedChangeId; |
| 172 |
return this; |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
bool CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::isIndirectlyConnectedNominalIndividual() { |
| 177 |
return mIndirectlyConnectedNominalIndividual; |
| 178 |
} |
| 179 |
|
| 180 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setIndirectlyConnectedNominalIndividual(bool indirectlyConnected) { |
| 181 |
mIndirectlyConnectedNominalIndividual = indirectlyConnected; |
| 182 |
return this; |
| 183 |
} |
| 184 |
|
| 185 |
|
| 186 |
bool CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::hasIndirectlyConnectedIndividualIntegration() { |
| 187 |
return mIndirectlyConnectedIndividualIntegration; |
| 188 |
} |
| 189 |
|
| 190 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setIndirectlyConnectedIndividualIntegration(bool indirectlyConnectedIndividualIntegration) { |
| 191 |
mIndirectlyConnectedIndividualIntegration = indirectlyConnectedIndividualIntegration; |
| 192 |
return this; |
| 193 |
} |
| 194 |
|
| 195 |
|
| 196 |
cint64 CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getRepresentativeSameIndividualId() { |
| 197 |
return mRepresentativeSameIndiId; |
| 198 |
} |
| 199 |
|
| 200 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setRepresentativeSameIndividualId(cint64 indiId) { |
| 201 |
mRepresentativeSameIndiId = indiId; |
| 202 |
return this; |
| 203 |
} |
| 204 |
|
| 205 |
|
| 206 |
cint64 CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::getDeterministicSameIndividualId() { |
| 207 |
return mDeterministicSameIndiId; |
| 208 |
} |
| 209 |
|
| 210 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setDeterministicSameIndividualId(cint64 indiId) { |
| 211 |
mDeterministicSameIndiId = indiId; |
| 212 |
return this; |
| 213 |
} |
| 214 |
|
| 215 |
bool CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::requireSameAsNeighboursCompletion() { |
| 216 |
return mRequireSameAsNeighboursCompletion; |
| 217 |
} |
| 218 |
|
| 219 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setRequireSameAsNeighboursCompletion(bool requireCompletion) { |
| 220 |
mRequireSameAsNeighboursCompletion = requireCompletion; |
| 221 |
return this; |
| 222 |
} |
| 223 |
|
| 224 |
bool CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::isScheduledIndividual() { |
| 225 |
return mScheduledIndividual; |
| 226 |
} |
| 227 |
|
| 228 |
CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker* CBackendRepresentativeMemoryCacheTemporaryAssociationWriteDataLinker::setScheduledIndividual(bool scheduled) { |
| 229 |
mScheduledIndividual = scheduled; |
| 230 |
return this; |
| 231 |
} |
| 232 |
|
| 233 |
|
| 234 |
}; // end namespace Cache |
| 235 |
|
| 236 |
}; // end namespace Kernel |
| 237 |
|
| 238 |
}; // end namespace Reasoner |
| 239 |
|
| 240 |
}; // end namespace Konclude |