| 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 "CSaturationATMOSTSuccessorMergingData.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Kernel { |
| 29 |
|
| 30 |
namespace Process { |
| 31 |
|
| 32 |
|
| 33 |
CSaturationATMOSTSuccessorMergingData::CSaturationATMOSTSuccessorMergingData(CProcessContext* processContext) : mProcessContext(processContext) { |
| 34 |
} |
| 35 |
|
| 36 |
CSaturationATMOSTSuccessorMergingData* CSaturationATMOSTSuccessorMergingData::initSuccessorMergingData(CIndividualSaturationProcessNode* indiProcessNode) { |
| 37 |
mNewSuccessorHash = nullptr; |
| 38 |
mMergingIndiProcessLinker.initProcessNodeLinker(indiProcessNode,false); |
| 39 |
|
| 40 |
mConceptMergingDataHash = nullptr; |
| 41 |
mMergingConceptLinker = nullptr; |
| 42 |
mRemainMergeableCardHash = nullptr; |
| 43 |
mMergeDistintHash = nullptr; |
| 44 |
mMergeDistintSet = nullptr; |
| 45 |
return this; |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
CIndividualSaturationProcessNodeLinker* CSaturationATMOSTSuccessorMergingData::getMergingIndividualProcessLinker() { |
| 50 |
return &mMergingIndiProcessLinker; |
| 51 |
} |
| 52 |
|
| 53 |
bool CSaturationATMOSTSuccessorMergingData::isMergingProcessingQueued() { |
| 54 |
return mMergingIndiProcessLinker.isProcessingQueued(); |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
CSaturationATMOSTSuccessorMergingHash* CSaturationATMOSTSuccessorMergingData::getATMOSTConceptMergingDataHash(bool create) { |
| 65 |
if (!mConceptMergingDataHash && create) { |
| 66 |
mConceptMergingDataHash = CObjectParameterizingAllocator< CSaturationATMOSTSuccessorMergingHash,CProcessContext* >::allocateAndConstructAndParameterize(mProcessContext->getUsedMemoryAllocationManager(),mProcessContext); |
| 67 |
mConceptMergingDataHash->initATMOSTConceptDescriptorMergingHash(); |
| 68 |
} |
| 69 |
return mConceptMergingDataHash; |
| 70 |
} |
| 71 |
|
| 72 |
CConceptSaturationProcessLinker* CSaturationATMOSTSuccessorMergingData::getMergingConceptLinker() { |
| 73 |
return mMergingConceptLinker; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
CSaturationATMOSTSuccessorMergingData* CSaturationATMOSTSuccessorMergingData::setMergingConceptLinker(CConceptSaturationProcessLinker* conceptLinker) { |
| 78 |
mMergingConceptLinker = conceptLinker; |
| 79 |
return this; |
| 80 |
} |
| 81 |
|
| 82 |
CSaturationATMOSTSuccessorMergingData* CSaturationATMOSTSuccessorMergingData::addMergingProcessingConcept(CConceptSaturationDescriptor* conSatDes) { |
| 83 |
CConceptSaturationProcessLinker* conSatProLinker = CObjectAllocator< CConceptSaturationProcessLinker >::allocateAndConstruct(mProcessContext->getUsedMemoryAllocationManager()); |
| 84 |
conSatProLinker->initConceptSaturationProcessLinker(conSatDes); |
| 85 |
mMergingConceptLinker = conSatProLinker->append(mMergingConceptLinker); |
| 86 |
return this; |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
CLinkedRoleSaturationSuccessorHash* CSaturationATMOSTSuccessorMergingData::getMergedLinkedRoleSaturationSuccessorHash(bool create) { |
| 92 |
if (!mNewSuccessorHash && create) { |
| 93 |
mNewSuccessorHash = CObjectParameterizingAllocator< CLinkedRoleSaturationSuccessorHash,CProcessContext* >::allocateAndConstructAndParameterize(mProcessContext->getUsedMemoryAllocationManager(),mProcessContext); |
| 94 |
mNewSuccessorHash->initRoleSuccessorHash(); |
| 95 |
} |
| 96 |
return mNewSuccessorHash; |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
CConceptSaturationProcessLinker* CSaturationATMOSTSuccessorMergingData::takeNextMergingConceptLinker() { |
| 101 |
if (mMergingConceptLinker) { |
| 102 |
mMergingConceptLinker = mMergingConceptLinker->getNext(); |
| 103 |
} |
| 104 |
return mMergingConceptLinker; |
| 105 |
} |
| 106 |
|
| 107 |
CSaturationATMOSTSuccessorMergingHashData& CSaturationATMOSTSuccessorMergingData::getATMOSTConceptMergingData(CConceptSaturationDescriptor* conSatDes) { |
| 108 |
if (!mConceptMergingDataHash) { |
| 109 |
getATMOSTConceptMergingDataHash(true); |
| 110 |
} |
| 111 |
return mConceptMergingDataHash->getATMOSTConceptMergingData(conSatDes); |
| 112 |
} |
| 113 |
|
| 114 |
CPROCESSHASH<CSaturationSuccessorData*,cint64>* CSaturationATMOSTSuccessorMergingData::getRemainingMergeableCardinalityHash(bool create) { |
| 115 |
if (!mRemainMergeableCardHash && create) { |
| 116 |
mRemainMergeableCardHash = CObjectParameterizingAllocator< CPROCESSHASH<CSaturationSuccessorData*,cint64>,CProcessContext* >::allocateAndConstructAndParameterize(mProcessContext->getUsedMemoryAllocationManager(),mProcessContext); |
| 117 |
} |
| 118 |
return mRemainMergeableCardHash; |
| 119 |
} |
| 120 |
|
| 121 |
CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>* CSaturationATMOSTSuccessorMergingData::getMergingDistintHash(bool create) { |
| 122 |
if (!mMergeDistintHash && create) { |
| 123 |
mMergeDistintHash = CObjectParameterizingAllocator< CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>,CProcessContext* >::allocateAndConstructAndParameterize(mProcessContext->getUsedMemoryAllocationManager(),mProcessContext); |
| 124 |
} |
| 125 |
return mMergeDistintHash; |
| 126 |
} |
| 127 |
|
| 128 |
CPROCESSSET< QPair<CSaturationSuccessorData*,CSaturationSuccessorData*> >* CSaturationATMOSTSuccessorMergingData::getMergingDistintSet(bool create) { |
| 129 |
if (!mMergeDistintSet && create) { |
| 130 |
mMergeDistintSet = CObjectParameterizingAllocator< CPROCESSSET< QPair<CSaturationSuccessorData*,CSaturationSuccessorData*> >,CProcessContext* >::allocateAndConstructAndParameterize(mProcessContext->getUsedMemoryAllocationManager(),mProcessContext); |
| 131 |
} |
| 132 |
return mMergeDistintSet; |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
}; // end namespace Process |
| 140 |
|
| 141 |
}; // end namespace Kernel |
| 142 |
|
| 143 |
}; // end namespace Reasoner |
| 144 |
|
| 145 |
}; // end namespace Konclude |