Debian Codegraph @

Source/Reasoner/Taxonomy/CAbstractHierarchyNode.cpp

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_TAXONOMY_CABSTRACTHIERARCHYNODE_CPP
22 #define KONCLUDE_REASONER_TAXONOMY_CABSTRACTHIERARCHYNODE_CPP
23
24
25 #include "CAbstractHierarchyNode.h"
26
27
28 namespace Konclude {
29
30 namespace Reasoner {
31
32 namespace Taxonomy {
33
34
35 template<class T, class E>
36 CAbstractHierarchyNode<T,E>::CAbstractHierarchyNode(const E &representiveElement) {
37 eqElementList.append(representiveElement);
38 eqElemCount = 1;
39 mNodeData = nullptr;
40 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
41 generateNodeElementStrings();
42 #endif
43 }
44
45
46 template<class T, class E>
47 CAbstractHierarchyNode<T,E>::~CAbstractHierarchyNode() {
48 }
49
50
51 template<class T, class E>
52 T* CAbstractHierarchyNode<T,E>::addEquivalentElement(const E &element) {
53 eqElementList.append(element);
54 eqElemCount++;
55 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
56 generateNodeElementStrings();
57 #endif
58 return (T*)this;
59 }
60
61
62 template<class T, class E>
63 QList<E>* CAbstractHierarchyNode<T,E>::getEquivalentElementList() {
64 return &eqElementList;
65 }
66
67
68 template<class T, class E>
69 E CAbstractHierarchyNode<T,E>::getOneEquivalentElement(const E &defaultValue) {
70 E element(defaultValue);
71 if (!eqElementList.isEmpty()) {
72 element = eqElementList.first();
73 }
74 return element;
75 }
76
77 template<class T, class E>
78 E CAbstractHierarchyNode<T,E>::getOneEquivalentElement() {
79 return eqElementList.first();
80 }
81
82
83 template<class T, class E>
84 qint64 CAbstractHierarchyNode<T,E>::getEquivalentElementCount() {
85 return eqElemCount;
86 }
87
88 template<class T, class E>
89 CHierarchyNodeData* CAbstractHierarchyNode<T,E>::getNodeData() {
90 return mNodeData;
91 }
92
93 template<class T, class E>
94 bool CAbstractHierarchyNode<T,E>::hasNodeData() {
95 return mNodeData != nullptr;
96 }
97
98 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
99 template<class T, class E>
100 void CAbstractHierarchyNode<T,E>::generateNodeElementStrings() {
101 }
102 #endif
103
104 template<class T, class E>
105 CHierarchyNodeData* CAbstractHierarchyNode<T,E>::setNodeData(CHierarchyNodeData* nodeData) {
106 CHierarchyNodeData* tmpData = nodeData;
107 mNodeData = nodeData;
108 return tmpData;
109 }
110
111
112
113 }; // end namespace Taxonomy
114
115 }; // end namespace Reasoner
116
117 }; // end namespace Konclude
118
119 #endif // KONCLUDE_REASONER_TAXONOMY_CABSTRACTHIERARCHYNODE_CPP