| 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_TAXONOMY_CPARENTCHILDPREDECESSORHIERARCHY_H |
| 22 |
#define KONCLUDE_REASONER_TAXONOMY_CPARENTCHILDPREDECESSORHIERARCHY_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
|
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "TaxonomySettings.h" |
| 29 |
#include "CAbstractHierarchy.h" |
| 30 |
#include "CAbstractHierarchyBuilder.h" |
| 31 |
#include "CParentChildPredecessorHierarchyNode.h" |
| 32 |
#include "CHierarchyDepthTraversalIterator.h" |
| 33 |
|
| 34 |
// Other includes |
| 35 |
|
| 36 |
|
| 37 |
// Logger includes |
| 38 |
#include "Logger/CLogger.h" |
| 39 |
|
| 40 |
|
| 41 |
namespace Konclude { |
| 42 |
|
| 43 |
namespace Reasoner { |
| 44 |
|
| 45 |
namespace Taxonomy { |
| 46 |
|
| 47 |
|
| 48 |
/*! |
| 49 |
* |
| 50 |
* \class CParentChildPredecessorHierarchy |
| 51 |
* \author Andreas Steigmiller |
| 52 |
* \version 0.1 |
| 53 |
* \brief TODO |
| 54 |
* |
| 55 |
*/ |
| 56 |
template<class T, class N, class E> |
| 57 |
class CParentChildPredecessorHierarchy : public CAbstractHierarchy<T,N,E>, public CAbstractHierarchyBuilder<T,N,E> { |
| 58 |
// public methods |
| 59 |
public: |
| 60 |
//! Constructor |
| 61 |
CParentChildPredecessorHierarchy(); |
| 62 |
CParentChildPredecessorHierarchy(N* topHierarchyNode, N* bottomHierarchyNode); |
| 63 |
CParentChildPredecessorHierarchy(const E& topElement, const E& bottomElement); |
| 64 |
|
| 65 |
//! Destructor |
| 66 |
virtual ~CParentChildPredecessorHierarchy(); |
| 67 |
|
| 68 |
T* initHierarchy(const E& topElement, const E& bottomElement); |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
virtual N* getTopHierarchyNode(); |
| 73 |
virtual N* getBottomHierarchyNode(); |
| 74 |
|
| 75 |
virtual N* getHierarchyNode(const E& element); |
| 76 |
|
| 77 |
virtual N* getHierarchyNode(const E& element, bool create); |
| 78 |
|
| 79 |
virtual bool hasHierarchyNode(const E& element); |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
virtual bool isNodeSubsumption(N* subsumerNode, N* subsumedNode); |
| 84 |
virtual bool isNodeEquivalence(N* node1, N* node2); |
| 85 |
virtual bool isNodeSatisfiable(N* node); |
| 86 |
virtual bool isNodeNotSatisfiable(N* node); |
| 87 |
|
| 88 |
virtual bool isTopHierarchyNode(N* node); |
| 89 |
virtual bool isBottomHierarchyNode(N* node); |
| 90 |
|
| 91 |
|
| 92 |
T* updateNodeEquivalentElements(N* node); |
| 93 |
|
| 94 |
|
| 95 |
virtual T* setNodeSatisfiable(N* node); |
| 96 |
virtual T* setNodeUnsatisfiable(N* node); |
| 97 |
virtual T* setNodeSubsumption(N* subsumerNode, N* subsumedNode); |
| 98 |
virtual T* setNodeEquivalence(N* eqNode1, N* eqNode2); |
| 99 |
|
| 100 |
|
| 101 |
virtual CHierarchyDepthTraversalIterator<N> getDepthTraversalIterator(bool forceUnique = true); |
| 102 |
|
| 103 |
|
| 104 |
// protected methods |
| 105 |
protected: |
| 106 |
N* createHierarchyNode(const E& element); |
| 107 |
|
| 108 |
bool repairedParentNodeInsertion(N* node, N* insertParentNode); |
| 109 |
bool repairInsertion(N* node, N* insertParentNode); |
| 110 |
|
| 111 |
|
| 112 |
// protected variables |
| 113 |
protected: |
| 114 |
QHash<E,N*> elmNodeHash; |
| 115 |
N* topNode; |
| 116 |
N* bottomNode; |
| 117 |
|
| 118 |
|
| 119 |
QList<N*> nodeContainer; |
| 120 |
|
| 121 |
// private methods |
| 122 |
private: |
| 123 |
|
| 124 |
// private variables |
| 125 |
private: |
| 126 |
|
| 127 |
}; |
| 128 |
|
| 129 |
}; // end namespace Taxonomy |
| 130 |
|
| 131 |
}; // end namespace Reasoner |
| 132 |
|
| 133 |
}; // end namespace Konclude |
| 134 |
|
| 135 |
#include "CParentChildPredecessorHierarchy.cpp" |
| 136 |
|
| 137 |
#endif // KONCLUDE_REASONER_TAXONOMY_CPARENTCHILDPREDECESSORHIERARCHY_H |