| 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 |
#ifndef KONCLUDE_REASONER_REALIZER_COPTIMIZEDREPRESENTATIVEKPSETCACHELABELCONCEPTSETITEMITERATOR_H |
| 22 |
#define KONCLUDE_REASONER_REALIZER_COPTIMIZEDREPRESENTATIVEKPSETCACHELABELCONCEPTSETITEMITERATOR_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
|
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "RealizerSettings.h" |
| 29 |
#include "COptimizedKPSetConceptInstancesItem.h" |
| 30 |
#include "COptimizedRepresentativeKPSetCacheLabelItemIterator.h" |
| 31 |
|
| 32 |
|
| 33 |
// Other includes |
| 34 |
#include "Reasoner/Kernel/Cache/CBackendRepresentativeMemoryCacheReader.h" |
| 35 |
|
| 36 |
|
| 37 |
// Logger includes |
| 38 |
#include "Logger/CLogger.h" |
| 39 |
|
| 40 |
|
| 41 |
namespace Konclude { |
| 42 |
|
| 43 |
namespace Reasoner { |
| 44 |
|
| 45 |
using namespace Kernel::Cache; |
| 46 |
using namespace Realization; |
| 47 |
|
| 48 |
namespace Realizer { |
| 49 |
|
| 50 |
|
| 51 |
typedef QPair<COptimizedKPSetConceptInstancesItem*, bool> TConceptInstancesItemMostSpecificFlagPair; |
| 52 |
|
| 53 |
|
| 54 |
/*! |
| 55 |
* |
| 56 |
* \class COptimizedRepresentativeKPSetCacheLabelConceptSetItemIterator |
| 57 |
* \author Andreas Steigmiller |
| 58 |
* \version 0.1 |
| 59 |
* \brief TODO |
| 60 |
* |
| 61 |
*/ |
| 62 |
class COptimizedRepresentativeKPSetCacheLabelConceptSetItemIterator : public COptimizedRepresentativeKPSetCacheLabelItemIterator { |
| 63 |
// public methods |
| 64 |
public: |
| 65 |
//! Constructor |
| 66 |
COptimizedRepresentativeKPSetCacheLabelConceptSetItemIterator(const QList<CBackendRepresentativeMemoryLabelCacheItem*>& labelCacheItemKnownInstancesList, const QList<CBackendRepresentativeMemoryLabelCacheItem*>& labelCacheItemPossibleInstancesList, COptimizedKPSetIndividualInstantiatedItemMultiHash* individualInstantiatedItemHash, CIndividualVector* individualVector, COptimizedKPSetConceptInstancesItem* conceptInstancesItem, bool onlyMostSpecificInstances, const CRealizationIndividualSorting& sorting, const CRealizationIndividualInstanceItemReference& indiInstItemRefCursor, bool moveOverCursor = true, CBackendRepresentativeMemoryCacheReader* backendAssocCacheReader = nullptr); |
| 67 |
COptimizedRepresentativeKPSetCacheLabelConceptSetItemIterator(const QList<CBackendRepresentativeMemoryLabelCacheItem*>& labelCacheItemKnownInstancesList, const QList<CBackendRepresentativeMemoryLabelCacheItem*>& labelCacheItemPossibleInstancesList, COptimizedKPSetIndividualInstantiatedItemMultiHash* individualInstantiatedItemHash, CIndividualVector* individualVector, const QHash<CBackendRepresentativeMemoryLabelCacheItem*, QSet<TConceptInstancesItemMostSpecificFlagPair>>& possibleLabelConceptInstancesItemOnlyMostSpecificFlagPairSetHash, const QSet<TConceptInstancesItemMostSpecificFlagPair>& onceptInstancesItemOnlyMostSpecificFlagPairSet, const CRealizationIndividualSorting& sorting, const CRealizationIndividualInstanceItemReference& indiInstItemRefCursor, bool moveOverCursor = true, CBackendRepresentativeMemoryCacheReader* backendAssocCacheReader = nullptr); |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
bool isValidIteratorPosition(CAssociationMapIteratorData* iteratorData, cint64 indiId); |
| 72 |
|
| 73 |
|
| 74 |
QHash<CBackendRepresentativeMemoryLabelCacheItem*, QSet<TConceptInstancesItemMostSpecificFlagPair>>* getPossibleLabelConceptInstancesItemOnlyMostSpecificFlagPairSetHash(); |
| 75 |
QSet<TConceptInstancesItemMostSpecificFlagPair>* getConceptInstancesItemOnlyMostSpecificFlagPairSet(); |
| 76 |
QSet<TConceptInstancesItemMostSpecificFlagPair>* currentConceptInstancesItemOnlyMostSpecificFlagPairSet(); |
| 77 |
|
| 78 |
|
| 79 |
// protected methods |
| 80 |
protected: |
| 81 |
class CAssociationMapIteratorDataWithConceptInstancesItems : public CAssociationMapIteratorData { |
| 82 |
public: |
| 83 |
CAssociationMapIteratorDataWithConceptInstancesItems(CBackendRepresentativeMemoryLabelCacheItem* labelItem, const CBackendRepresentativeMemoryLabelCacheItemIndividualAssociationMapIterator& iterator, bool possibleInstances) : CAssociationMapIteratorData(labelItem, iterator, possibleInstances) { |
| 84 |
} |
| 85 |
|
| 86 |
QSet<TConceptInstancesItemMostSpecificFlagPair> mConceptInstancesItemOnlyMostSpecificFlagPairSet; |
| 87 |
}; |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
CRealizationIndividualInstanceItemReferenceIterator* getCopy(); |
| 92 |
CRealizationIndividualInstanceItemReferenceIterator* initCopy(CRealizationIndividualInstanceItemReferenceIterator* iterator); |
| 93 |
|
| 94 |
CAssociationMapIteratorData* createAssociationMapIteratorData(CBackendRepresentativeMemoryLabelCacheItem* labelItem, const CBackendRepresentativeMemoryLabelCacheItemIndividualAssociationMapIterator& iterator, bool possibleInstances); |
| 95 |
|
| 96 |
// protected variables |
| 97 |
protected: |
| 98 |
QHash<CBackendRepresentativeMemoryLabelCacheItem*, QSet<TConceptInstancesItemMostSpecificFlagPair>> mPossibleLabelConceptInstancesItemOnlyMostSpecificFlagPairSetHash; |
| 99 |
QSet<TConceptInstancesItemMostSpecificFlagPair> mConceptInstancesItemOnlyMostSpecificFlagPairSet; |
| 100 |
CBackendRepresentativeMemoryCacheReader* mBackendAssocCacheReader; |
| 101 |
// private methods |
| 102 |
private: |
| 103 |
|
| 104 |
// private variables |
| 105 |
private: |
| 106 |
|
| 107 |
}; |
| 108 |
|
| 109 |
}; // end namespace Realizer |
| 110 |
|
| 111 |
}; // end namespace Reasoner |
| 112 |
|
| 113 |
}; // end namespace Konclude |
| 114 |
|
| 115 |
#endif // KONCLUDE_REASONER_REALIZER_COPTIMIZEDREPRESENTATIVEKPSETCACHELABELCONCEPTSETITEMITERATOR_H |