/* * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. * * This file is part of the reasoning system Konclude. * For details and support, see . * * Konclude is free software: you can redistribute it and/or modify * it under the terms of version 3 of the GNU Lesser General Public * License (LGPLv3) as published by the Free Software Foundation. * * Konclude is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU (Lesser) General Public License for more details. * * You should have received a copy of the GNU (Lesser) General Public * License along with Konclude. If not, see . * */ #ifndef KONCLUDE_REASONER_TAXONOMY_CPARENTCHILDPREDECESSORHIERARCHYNODE_CPP #define KONCLUDE_REASONER_TAXONOMY_CPARENTCHILDPREDECESSORHIERARCHYNODE_CPP #include "CParentChildPredecessorHierarchyNode.h" namespace Konclude { namespace Reasoner { namespace Taxonomy { template CParentChildPredecessorHierarchyNode::CParentChildPredecessorHierarchyNode(const E &representiveElement) : CAbstractHierarchyNode(representiveElement) { addPredecessorNode(this); } template CParentChildPredecessorHierarchyNode::~CParentChildPredecessorHierarchyNode() { } template T* CParentChildPredecessorHierarchyNode::addParentNode(CParentChildPredecessorHierarchyNode* parentNode) { parentNodeSet.insert(parentNode); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template T* CParentChildPredecessorHierarchyNode::addChildNode(CParentChildPredecessorHierarchyNode* childNode) { childNodeSet.insert(childNode); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template T* CParentChildPredecessorHierarchyNode::makeParent(CParentChildPredecessorHierarchyNode* parentNode) { parentNodeSet.insert(parentNode); parentNode->addChildNode(this); makePredecessor(parentNode); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template T* CParentChildPredecessorHierarchyNode::makeChild(CParentChildPredecessorHierarchyNode* childNode) { childNodeSet.insert(childNode); childNode->addParentNode(this); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template bool CParentChildPredecessorHierarchyNode::hasChildNode(CParentChildPredecessorHierarchyNode* node) { return childNodeSet.contains(node); } template bool CParentChildPredecessorHierarchyNode::hasParentNode(CParentChildPredecessorHierarchyNode* node) { return parentNodeSet.contains(node); } template T* CParentChildPredecessorHierarchyNode::addPredecessorNode(CParentChildPredecessorHierarchyNode* preNode) { predNodeSet.insert(preNode); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template T* CParentChildPredecessorHierarchyNode::makePredecessor(CParentChildPredecessorHierarchyNode* preNode) { predNodeSet.insert(preNode); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template bool CParentChildPredecessorHierarchyNode::hasPredecessorNode(CParentChildPredecessorHierarchyNode* node) { return predNodeSet.contains(node); } template T* CParentChildPredecessorHierarchyNode::removeParent(CParentChildPredecessorHierarchyNode* parentNode) { parentNodeSet.remove(parentNode); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template T* CParentChildPredecessorHierarchyNode::removeChild(CParentChildPredecessorHierarchyNode* childNode) { childNodeSet.remove(childNode); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template QSet* CParentChildPredecessorHierarchyNode::getParentNodeSet() { return (QSet* )&parentNodeSet; } template QSet* CParentChildPredecessorHierarchyNode::getChildNodeSet() { return (QSet* )&childNodeSet; } template QSet* CParentChildPredecessorHierarchyNode::getPredecessorNodeSet() { return (QSet* )&predNodeSet; } template T* CParentChildPredecessorHierarchyNode::removePredecessor(CParentChildPredecessorHierarchyNode* predNode) { predNodeSet.remove(predNode); #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS generateNodeRelationStrings(); #endif return (T*)this; } template QList CParentChildPredecessorHierarchyNode::getParentNodeList() { QList parentNodeList(parentNodeSet.values()); return (*(QList* )(&parentNodeList)); } template QList CParentChildPredecessorHierarchyNode::getChildNodeList() { QList childNodeList(childNodeSet.values()); return (*(QList* )(&(childNodeList))); } template QList CParentChildPredecessorHierarchyNode::getPredecessorNodeList() { QList predNodeList(predNodeSet.values()); return (*(QList* )(&(predNodeList))); } #ifdef DEBUGHIERARCHYNODEELEMENTSTRINGS template void CParentChildPredecessorHierarchyNode::generateNodeRelationStrings() { } #endif }; // end namespace Taxonomy }; // end namespace Reasoner }; // end namespace Konclude #endif // KONCLUDE_REASONER_TAXONOMY_CPARENTCHILDPREDECESSORHIERARCHYNODE_CPP