Debian Codegraph @

Source/Reasoner/Taxonomy/CParentChildPredecessorHierarchyNode.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_CPARENTCHILDPREDECESSORHIERARCHYNODE_CPP
22 #define KONCLUDE_REASONER_TAXONOMY_CPARENTCHILDPREDECESSORHIERARCHYNODE_CPP
23
24
25 #include "CParentChildPredecessorHierarchyNode.h"
26
27
28 namespace Konclude {
29
30 namespace Reasoner {
31
32 namespace Taxonomy {
33
34
35 template<class T, class E>
36 CParentChildPredecessorHierarchyNode<T,E>::CParentChildPredecessorHierarchyNode(const E &representiveElement) : CAbstractHierarchyNode<T,E>(representiveElement) {
37 addPredecessorNode(this);
38 }
39
40
41 template<class T, class E>
42 CParentChildPredecessorHierarchyNode<T,E>::~CParentChildPredecessorHierarchyNode() {
43 }
44
45
46 template<class T, class E>
47 T* CParentChildPredecessorHierarchyNode<T,E>::addParentNode(CParentChildPredecessorHierarchyNode<T,E>* parentNode) {
48 parentNodeSet.insert(parentNode);
49 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
50 generateNodeRelationStrings();
51 #endif
52 return (T*)this;
53 }
54
55 template<class T, class E>
56 T* CParentChildPredecessorHierarchyNode<T,E>::addChildNode(CParentChildPredecessorHierarchyNode<T,E>* childNode) {
57 childNodeSet.insert(childNode);
58 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
59 generateNodeRelationStrings();
60 #endif
61 return (T*)this;
62 }
63
64 template<class T, class E>
65 T* CParentChildPredecessorHierarchyNode<T,E>::makeParent(CParentChildPredecessorHierarchyNode<T,E>* parentNode) {
66 parentNodeSet.insert(parentNode);
67 parentNode->addChildNode(this);
68 makePredecessor(parentNode);
69 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
70 generateNodeRelationStrings();
71 #endif
72 return (T*)this;
73 }
74
75 template<class T, class E>
76 T* CParentChildPredecessorHierarchyNode<T,E>::makeChild(CParentChildPredecessorHierarchyNode<T,E>* childNode) {
77 childNodeSet.insert(childNode);
78 childNode->addParentNode(this);
79 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
80 generateNodeRelationStrings();
81 #endif
82 return (T*)this;
83 }
84
85 template<class T, class E>
86 bool CParentChildPredecessorHierarchyNode<T,E>::hasChildNode(CParentChildPredecessorHierarchyNode<T,E>* node) {
87 return childNodeSet.contains(node);
88 }
89
90 template<class T, class E>
91 bool CParentChildPredecessorHierarchyNode<T,E>::hasParentNode(CParentChildPredecessorHierarchyNode<T,E>* node) {
92 return parentNodeSet.contains(node);
93 }
94
95
96
97 template<class T, class E>
98 T* CParentChildPredecessorHierarchyNode<T,E>::addPredecessorNode(CParentChildPredecessorHierarchyNode<T,E>* preNode) {
99 predNodeSet.insert(preNode);
100 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
101 generateNodeRelationStrings();
102 #endif
103 return (T*)this;
104 }
105
106
107
108 template<class T, class E>
109 T* CParentChildPredecessorHierarchyNode<T,E>::makePredecessor(CParentChildPredecessorHierarchyNode<T,E>* preNode) {
110 predNodeSet.insert(preNode);
111 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
112 generateNodeRelationStrings();
113 #endif
114 return (T*)this;
115 }
116
117
118
119 template<class T, class E>
120 bool CParentChildPredecessorHierarchyNode<T,E>::hasPredecessorNode(CParentChildPredecessorHierarchyNode<T,E>* node) {
121 return predNodeSet.contains(node);
122 }
123
124
125
126 template<class T, class E>
127 T* CParentChildPredecessorHierarchyNode<T,E>::removeParent(CParentChildPredecessorHierarchyNode<T,E>* parentNode) {
128 parentNodeSet.remove(parentNode);
129 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
130 generateNodeRelationStrings();
131 #endif
132 return (T*)this;
133 }
134
135 template<class T, class E>
136 T* CParentChildPredecessorHierarchyNode<T,E>::removeChild(CParentChildPredecessorHierarchyNode<T,E>* childNode) {
137 childNodeSet.remove(childNode);
138 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
139 generateNodeRelationStrings();
140 #endif
141 return (T*)this;
142 }
143
144
145
146 template<class T, class E>
147 QSet<T*>* CParentChildPredecessorHierarchyNode<T,E>::getParentNodeSet() {
148 return (QSet<T*>* )&parentNodeSet;
149 }
150
151 template<class T, class E>
152 QSet<T*>* CParentChildPredecessorHierarchyNode<T,E>::getChildNodeSet() {
153 return (QSet<T*>* )&childNodeSet;
154 }
155
156 template<class T, class E>
157 QSet<T*>* CParentChildPredecessorHierarchyNode<T,E>::getPredecessorNodeSet() {
158 return (QSet<T*>* )&predNodeSet;
159 }
160
161
162
163 template<class T, class E>
164 T* CParentChildPredecessorHierarchyNode<T,E>::removePredecessor(CParentChildPredecessorHierarchyNode<T,E>* predNode) {
165 predNodeSet.remove(predNode);
166 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
167 generateNodeRelationStrings();
168 #endif
169 return (T*)this;
170 }
171
172 template<class T, class E>
173 QList<T*> CParentChildPredecessorHierarchyNode<T,E>::getParentNodeList() {
174 QList<CParentChildPredecessorHierarchyNode*> parentNodeList(parentNodeSet.values());
175 return (*(QList<T*>* )(&parentNodeList));
176 }
177
178 template<class T, class E>
179 QList<T*> CParentChildPredecessorHierarchyNode<T,E>::getChildNodeList() {
180 QList<CParentChildPredecessorHierarchyNode*> childNodeList(childNodeSet.values());
181 return (*(QList<T*>* )(&(childNodeList)));
182 }
183
184 template<class T, class E>
185 QList<T*> CParentChildPredecessorHierarchyNode<T,E>::getPredecessorNodeList() {
186 QList<CParentChildPredecessorHierarchyNode*> predNodeList(predNodeSet.values());
187 return (*(QList<T*>* )(&(predNodeList)));
188 }
189
190
191
192 #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS
193 template<class T, class E>
194 void CParentChildPredecessorHierarchyNode<T,E>::generateNodeRelationStrings() {
195 }
196 #endif
197
198
199
200 }; // end namespace Taxonomy
201
202 }; // end namespace Reasoner
203
204 }; // end namespace Konclude
205
206 #endif // KONCLUDE_REASONER_TAXONOMY_CPARENTCHILDPREDECESSORHIERARCHYNODE_CPP