| 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 |
#include "CNominalSchemaAbsorptionBranchLinker.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Preprocess { |
| 29 |
|
| 30 |
|
| 31 |
CNominalSchemaAbsorptionBranchLinker::CNominalSchemaAbsorptionBranchLinker() : CLinkerBase<CNominalSchemaAbsorptionBranchLinker*,CNominalSchemaAbsorptionBranchLinker>(this) { |
| 32 |
} |
| 33 |
|
| 34 |
CNominalSchemaAbsorptionBranchLinker* CNominalSchemaAbsorptionBranchLinker::initNominalSchemaAbsorptionPathLinker(CNominalSchemaAbsorptionBranchLinker* nomSchAbsorpPathLinker) { |
| 35 |
if (nomSchAbsorpPathLinker) { |
| 36 |
mNomSchBindConceptHash = nomSchAbsorpPathLinker->mNomSchBindConceptHash; |
| 37 |
mVariableSet = nomSchAbsorpPathLinker->mVariableSet; |
| 38 |
mLastBranchTriggerConcept = nomSchAbsorpPathLinker->mLastBranchTriggerConcept; |
| 39 |
mBackPropagationBranchTriggerConcept = nomSchAbsorpPathLinker->mBackPropagationBranchTriggerConcept; |
| 40 |
} else { |
| 41 |
mBackPropagationBranchTriggerConcept = nullptr; |
| 42 |
mLastBranchTriggerConcept = nullptr; |
| 43 |
mNomSchBindConceptHash.clear(); |
| 44 |
mVariableSet.clear(); |
| 45 |
} |
| 46 |
return this; |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
CNominalSchemaAbsorptionBranchLinker* CNominalSchemaAbsorptionBranchLinker::joinNominalSchemaAbsorptionPathLinker(CNominalSchemaAbsorptionBranchLinker* nomSchAbsorpPathLinker1, CNominalSchemaAbsorptionBranchLinker* nomSchAbsorpPathLinker2) { |
| 51 |
mNomSchBindConceptHash = nomSchAbsorpPathLinker1->mNomSchBindConceptHash; |
| 52 |
for (QHash<CConcept*,CConcept*>::const_iterator it = nomSchAbsorpPathLinker2->mNomSchBindConceptHash.constBegin(), itEnd = nomSchAbsorpPathLinker2->mNomSchBindConceptHash.constEnd(); it != itEnd; ++it) { |
| 53 |
mNomSchBindConceptHash.insertMulti(it.key(),it.value()); |
| 54 |
} |
| 55 |
mVariableSet = nomSchAbsorpPathLinker1->mVariableSet; |
| 56 |
mVariableSet += nomSchAbsorpPathLinker2->mVariableSet; |
| 57 |
mLastBranchTriggerConcept = nullptr; |
| 58 |
mBackPropagationBranchTriggerConcept = nullptr; |
| 59 |
return this; |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
QHash<CConcept*,CConcept*>* CNominalSchemaAbsorptionBranchLinker::getNominalSchemaBindedConceptTriggerHash() { |
| 64 |
return &mNomSchBindConceptHash; |
| 65 |
} |
| 66 |
|
| 67 |
QSet<CVariable*>* CNominalSchemaAbsorptionBranchLinker::getVariableSet() { |
| 68 |
return &mVariableSet; |
| 69 |
} |
| 70 |
|
| 71 |
bool CNominalSchemaAbsorptionBranchLinker::hasVariables() { |
| 72 |
return !mVariableSet.isEmpty(); |
| 73 |
} |
| 74 |
|
| 75 |
CNominalSchemaAbsorptionBranchLinker* CNominalSchemaAbsorptionBranchLinker::addVariable(CVariable* variable) { |
| 76 |
mVariableSet.insert(variable); |
| 77 |
return this; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
CConcept* CNominalSchemaAbsorptionBranchLinker::getLastBranchTriggerConcept() { |
| 83 |
return mLastBranchTriggerConcept; |
| 84 |
} |
| 85 |
|
| 86 |
CNominalSchemaAbsorptionBranchLinker* CNominalSchemaAbsorptionBranchLinker::setLastBranchTriggerConcept(CConcept* lastBranchTriggerConcept) { |
| 87 |
mLastBranchTriggerConcept = lastBranchTriggerConcept; |
| 88 |
return this; |
| 89 |
} |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
CConcept* CNominalSchemaAbsorptionBranchLinker::getBackPropagationBranchTriggerConcept() { |
| 94 |
return mBackPropagationBranchTriggerConcept; |
| 95 |
} |
| 96 |
|
| 97 |
CNominalSchemaAbsorptionBranchLinker* CNominalSchemaAbsorptionBranchLinker::setBackPropagationBranchTriggerConcept(CConcept* backPropagationBranchTriggerConcept) { |
| 98 |
mBackPropagationBranchTriggerConcept = backPropagationBranchTriggerConcept; |
| 99 |
return this; |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
}; // end namespace Preprocess |
| 104 |
|
| 105 |
}; // end namespace Reasoner |
| 106 |
|
| 107 |
}; // end namespace Konclude |