| 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 "COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Realizer { |
| 29 |
|
| 30 |
|
| 31 |
COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData(CBackendRepresentativeMemoryLabelCacheItem* combinedNeighbourRoleLabelCacheItem) { |
| 32 |
mCombinedNeighbourRoleLabelCacheItem = combinedNeighbourRoleLabelCacheItem; |
| 33 |
mPossibleInstances = false; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
bool COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::hasPossibleInstances() { |
| 38 |
return mPossibleInstances; |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
CBackendRepresentativeMemoryLabelCacheItem* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::getCombinedNeighbourRoleLabelCacheItem() { |
| 43 |
return mCombinedNeighbourRoleLabelCacheItem; |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::setPossibleInstances(bool possibleInstances) { |
| 48 |
mPossibleInstances = possibleInstances; |
| 49 |
return this; |
| 50 |
} |
| 51 |
|
| 52 |
QHash<COptimizedKPSetRoleInstancesItem*, COptimizedRepresentativeKPSetSingleNeighbourRoleSetCacheLabelItemInstancesData*>* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::getInstancesItemDataHash() { |
| 53 |
return &mInstancesItemDataHash; |
| 54 |
} |
| 55 |
|
| 56 |
COptimizedRepresentativeKPSetSingleNeighbourRoleSetCacheLabelItemInstancesData* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::getInstancesItemData(COptimizedKPSetRoleInstancesItem* instanceItem, bool createIfNotExists) { |
| 57 |
COptimizedRepresentativeKPSetSingleNeighbourRoleSetCacheLabelItemInstancesData*& instancesData = mInstancesItemDataHash[instanceItem]; |
| 58 |
if (!instancesData && createIfNotExists) { |
| 59 |
instancesData = new COptimizedRepresentativeKPSetSingleNeighbourRoleSetCacheLabelItemInstancesData(); |
| 60 |
} |
| 61 |
return instancesData; |
| 62 |
} |
| 63 |
|
| 64 |
QSet<COptimizedKPSetRoleInstancesItem*>* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::getKnownInstancesItemSet(bool inverse) { |
| 65 |
if (!inverse) { |
| 66 |
return &mKnownInstancesItemSet; |
| 67 |
} else { |
| 68 |
return &mInverseKnownInstancesItemSet; |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
QSet<COptimizedKPSetRoleInstancesItem*>* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::getPossibleInstancesItemSet(bool inverse) { |
| 73 |
if (!inverse) { |
| 74 |
return &mPossibleInstancesItemSet; |
| 75 |
} else { |
| 76 |
return &mInversePossibleInstancesItemSet; |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::addKnownInstancesItem(COptimizedKPSetRoleInstancesItem* roleItem, bool inverse) { |
| 82 |
if (!inverse) { |
| 83 |
mKnownInstancesItemSet.insert(roleItem); |
| 84 |
} else { |
| 85 |
mInverseKnownInstancesItemSet.insert(roleItem); |
| 86 |
} |
| 87 |
return this; |
| 88 |
} |
| 89 |
|
| 90 |
COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::addPossibleInstancesItem(COptimizedKPSetRoleInstancesItem* roleItem, bool inverse) { |
| 91 |
if (!inverse) { |
| 92 |
mPossibleInstancesItemSet.insert(roleItem); |
| 93 |
} else { |
| 94 |
mInversePossibleInstancesItemSet.insert(roleItem); |
| 95 |
} |
| 96 |
return this; |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
QSet<COptimizedKPSetRoleInstancesItem*>* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::getComplexCandiateInstancesItemSet(bool inverse) { |
| 101 |
if (inverse) { |
| 102 |
return &mInverseComplexCandiateInstancesItemSet; |
| 103 |
} else { |
| 104 |
return &mComplexCandiateInstancesItemSet; |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData* COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::addComplexCandiateInstancesItem(COptimizedKPSetRoleInstancesItem* roleItem, bool inverse) { |
| 109 |
if (inverse) { |
| 110 |
mInverseComplexCandiateInstancesItemSet.insert(roleItem); |
| 111 |
} else { |
| 112 |
mComplexCandiateInstancesItemSet.insert(roleItem); |
| 113 |
} |
| 114 |
return this; |
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
bool COptimizedRepresentativeKPSetCombinedNeighbourRoleSetCacheLabelItemData::hasComplexCandiateInstancesItems() { |
| 119 |
return !mComplexCandiateInstancesItemSet.isEmpty() || !mInverseComplexCandiateInstancesItemSet.isEmpty(); |
| 120 |
} |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
}; // end namespace Realizer |
| 125 |
|
| 126 |
}; // end namespace Reasoner |
| 127 |
|
| 128 |
}; // end namespace Konclude |