| 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 "CPrecomputationTestingStep.h" |
| 22 |
#include "COntologyPrecomputationItem.h" |
| 23 |
|
| 24 |
|
| 25 |
namespace Konclude { |
| 26 |
|
| 27 |
namespace Reasoner { |
| 28 |
|
| 29 |
namespace Consistiser { |
| 30 |
|
| 31 |
|
| 32 |
CPrecomputationTestingStep::CPrecomputationTestingStep(TESTINGSTEPTYPE testingStepType, COntologyProcessingStepData* processingStepData, COntologyPrecomputationItem* precompItem) { |
| 33 |
mTestingStepType = testingStepType; |
| 34 |
mOntologyPrecompItem = precompItem; |
| 35 |
mProcessingStepData = processingStepData; |
| 36 |
mStepFinished = false; |
| 37 |
mCombineLastFlags = 0; |
| 38 |
} |
| 39 |
|
| 40 |
COntologyPrecomputationItem* CPrecomputationTestingStep::getOntologyPrecomputationItem() { |
| 41 |
return mOntologyPrecompItem; |
| 42 |
} |
| 43 |
|
| 44 |
CPrecomputationTestingStep* CPrecomputationTestingStep::setOntologyPrecomputationItem(COntologyPrecomputationItem* precompItem) { |
| 45 |
mOntologyPrecompItem = precompItem; |
| 46 |
return this; |
| 47 |
} |
| 48 |
|
| 49 |
bool CPrecomputationTestingStep::isStepFinished() { |
| 50 |
return mStepFinished; |
| 51 |
} |
| 52 |
|
| 53 |
bool CPrecomputationTestingStep::areStepProcessingRequirementSatisfied() { |
| 54 |
return mProcessingStepData->getProcessingStep()->areAllRequirementsSatisfied(mOntologyPrecompItem->getOntology()); |
| 55 |
} |
| 56 |
|
| 57 |
bool CPrecomputationTestingStep::hasRequirements() { |
| 58 |
return !mRequirementStepDataList.isEmpty(); |
| 59 |
} |
| 60 |
|
| 61 |
CPrecomputationTestingStep* CPrecomputationTestingStep::setStepFinished(bool finished) { |
| 62 |
mStepFinished = finished; |
| 63 |
cint64 installFlags = COntologyProcessingStatus::PSCOMPLETELYYPROCESSED; |
| 64 |
mProcessingStepData->getProcessingStatus()->setProcessingFlags(installFlags); |
| 65 |
return this; |
| 66 |
} |
| 67 |
|
| 68 |
QList<COntologyProcessingRequirement*>* CPrecomputationTestingStep::getRequirementList() { |
| 69 |
return &mRequirementStepDataList; |
| 70 |
} |
| 71 |
|
| 72 |
COntologyProcessingStepData* CPrecomputationTestingStep::getProcessingStepData() { |
| 73 |
return mProcessingStepData; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
CPrecomputationTestingStep::TESTINGSTEPTYPE CPrecomputationTestingStep::getPrecomputationTestingType() { |
| 78 |
return mTestingStepType; |
| 79 |
} |
| 80 |
|
| 81 |
CPrecomputationTestingStep* CPrecomputationTestingStep::setProcessingStepData(COntologyProcessingStepData* processingData) { |
| 82 |
mProcessingStepData = processingData; |
| 83 |
return this; |
| 84 |
} |
| 85 |
|
| 86 |
CPrecomputationTestingStep* CPrecomputationTestingStep::addProcessingRequirement(COntologyProcessingRequirement* processingRequirement) { |
| 87 |
mRequirementStepDataList.append(processingRequirement); |
| 88 |
return this; |
| 89 |
} |
| 90 |
|
| 91 |
CPrecomputationTestingStep* CPrecomputationTestingStep::submitRequirementsUpdate(bool clearRequirements) { |
| 92 |
submitRequirementsUpdate(mCombineLastFlags,true); |
| 93 |
return this; |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
CPrecomputationTestingStep* CPrecomputationTestingStep::submitRequirementsUpdate(cint64 flags, bool clearRequirements) { |
| 98 |
mCombineLastFlags |= flags; |
| 99 |
mProcessingStepData->getProcessingStatus()->setErrorFlags(mCombineLastFlags); |
| 100 |
|
| 101 |
for (QList<COntologyProcessingRequirement*>::const_iterator it = mRequirementStepDataList.constBegin(), itEnd = mRequirementStepDataList.constEnd(); it != itEnd; ++it) { |
| 102 |
COntologyProcessingRequirement* requirement(*it); |
| 103 |
requirement->submitRequirementUpdate(COntologyProcessingStatus::PSCOMPLETELYYPROCESSED,mCombineLastFlags); |
| 104 |
} |
| 105 |
|
| 106 |
if (clearRequirements) { |
| 107 |
mRequirementStepDataList.clear(); |
| 108 |
} |
| 109 |
return this; |
| 110 |
} |
| 111 |
|
| 112 |
}; // end namespace Consistiser |
| 113 |
|
| 114 |
}; // end namespace Reasoner |
| 115 |
|
| 116 |
}; // end namespace Konclude |