| 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 "CComplexQueryExpressionProcessingData.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Answerer { |
| 29 |
|
| 30 |
|
| 31 |
CComplexQueryExpressionProcessingData::CComplexQueryExpressionProcessingData(CComplexAnsweringExpressionQuery* query, CCallbackData* callback) : CComplexQueryProcessingData(query, callback) { |
| 32 |
mQuery = query; |
| 33 |
mWaitingComputationStepsCount = 0; |
| 34 |
mConceptItem = nullptr; |
| 35 |
mWaitingEntailmentComputationsCount = 0; |
| 36 |
mBuildingVariableItemCount = 0; |
| 37 |
mVariableBuildingItem = nullptr; |
| 38 |
mFinishingHandler = nullptr; |
| 39 |
mOffsetSkippedMappingCount = 0; |
| 40 |
mQueryProcessingInitializedAnsweringStatistics = nullptr; |
| 41 |
mComputationError = false; |
| 42 |
mExtendibleData = nullptr; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
CComplexQueryExpressionProcessingData::~CComplexQueryExpressionProcessingData() { |
| 47 |
} |
| 48 |
|
| 49 |
CComplexAnsweringExpressionQuery* CComplexQueryExpressionProcessingData::getQuery() { |
| 50 |
return mQuery; |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
bool CComplexQueryExpressionProcessingData::isWaitingComputationStep() { |
| 55 |
return mWaitingComputationStepsCount > 0; |
| 56 |
} |
| 57 |
|
| 58 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::setComputationStepFinished(CComplexConceptStepComputationProcess* computationStep) { |
| 59 |
mWaitingComputationStepsCount--; |
| 60 |
return this; |
| 61 |
} |
| 62 |
|
| 63 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::setComputationStepWaiting(CComplexConceptStepComputationProcess* computationStep) { |
| 64 |
mWaitingComputationStepsCount++; |
| 65 |
return this; |
| 66 |
} |
| 67 |
|
| 68 |
COptimizedComplexConceptItem* CComplexQueryExpressionProcessingData::getConceptItem() { |
| 69 |
return mConceptItem; |
| 70 |
} |
| 71 |
|
| 72 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::setConceptItem(COptimizedComplexConceptItem* conceptItem) { |
| 73 |
mConceptItem = conceptItem; |
| 74 |
return this; |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
bool CComplexQueryExpressionProcessingData::isComputationError() { |
| 79 |
return mComputationError; |
| 80 |
} |
| 81 |
|
| 82 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::setComputationError(bool error) { |
| 83 |
mComputationError = error; |
| 84 |
return this; |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
bool CComplexQueryExpressionProcessingData::hasEntailmentComputation() { |
| 90 |
return mWaitingEntailmentComputationsCount > 0; |
| 91 |
} |
| 92 |
|
| 93 |
bool CComplexQueryExpressionProcessingData::hasComputation() { |
| 94 |
return hasEntailmentComputation() || isWaitingComputationStep() || isBuildingVariableItem(); |
| 95 |
} |
| 96 |
|
| 97 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::incEntailmentComputation(cint64 count) { |
| 98 |
mWaitingEntailmentComputationsCount += count; |
| 99 |
return this; |
| 100 |
} |
| 101 |
|
| 102 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::decEntailmentComputation(cint64 count) { |
| 103 |
mWaitingEntailmentComputationsCount -= count; |
| 104 |
return this; |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
bool CComplexQueryExpressionProcessingData::isBuildingVariableItem() { |
| 109 |
return mBuildingVariableItemCount > 0; |
| 110 |
} |
| 111 |
|
| 112 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::incBuildingVariableItem(cint64 count) { |
| 113 |
mBuildingVariableItemCount += count; |
| 114 |
return this; |
| 115 |
} |
| 116 |
|
| 117 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::decBuildingVariableItem(cint64 count) { |
| 118 |
mBuildingVariableItemCount -= count; |
| 119 |
return this; |
| 120 |
} |
| 121 |
|
| 122 |
COptimizedComplexBuildingVariableCompositionsItem* CComplexQueryExpressionProcessingData::getVariableBuildingItem() { |
| 123 |
return mVariableBuildingItem; |
| 124 |
} |
| 125 |
|
| 126 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::setVariableBuildingItem(COptimizedComplexBuildingVariableCompositionsItem* variableBuildingItem) { |
| 127 |
mVariableBuildingItem = variableBuildingItem; |
| 128 |
return this; |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
CAbstractComplexQueryFinishingHandler* CComplexQueryExpressionProcessingData::getFinishingHandler() { |
| 134 |
return mFinishingHandler; |
| 135 |
} |
| 136 |
|
| 137 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::setFinishingHandler(CAbstractComplexQueryFinishingHandler* finishingHandler) { |
| 138 |
mFinishingHandler = finishingHandler; |
| 139 |
return this; |
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
cint64 CComplexQueryExpressionProcessingData::getOffsetSkippedMappingCount() { |
| 144 |
return mOffsetSkippedMappingCount; |
| 145 |
} |
| 146 |
|
| 147 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::setOffsetSkippedMappingCount(cint64 skippedMappingCount) { |
| 148 |
mOffsetSkippedMappingCount = skippedMappingCount; |
| 149 |
return this; |
| 150 |
} |
| 151 |
|
| 152 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::incOffsetSkippedMappingCount(cint64 incSkippedMappingCount) { |
| 153 |
mOffsetSkippedMappingCount += incSkippedMappingCount; |
| 154 |
return this; |
| 155 |
} |
| 156 |
|
| 157 |
CComplexQueryExtendibleData* CComplexQueryExpressionProcessingData::getQueryExtendibleData() { |
| 158 |
return mExtendibleData; |
| 159 |
} |
| 160 |
|
| 161 |
CComplexQueryExpressionProcessingData* CComplexQueryExpressionProcessingData::setQueryExtendibleData(CComplexQueryExtendibleData* extData) { |
| 162 |
mExtendibleData = extData; |
| 163 |
return this; |
| 164 |
} |
| 165 |
|
| 166 |
|
| 167 |
}; // end namespace Answerer |
| 168 |
|
| 169 |
}; // end namespace Reasoner |
| 170 |
|
| 171 |
}; // end namespace Konclude |