Debian Codegraph @

Source/Reasoner/Realizer/COptimizedRepresentativeKPSetCacheLabelRoleNeighbouringItemIterator.h

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