| 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_KERNEL_PROCESS_CDATATYPEREALVALUESPACEMAP_H |
| 22 |
#define KONCLUDE_REASONER_KERNEL_PROCESS_CDATATYPEREALVALUESPACEMAP_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
|
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "ProcessSettings.h" |
| 29 |
#include "CProcessContext.h" |
| 30 |
#include "CDatatypeRealValueData.h" |
| 31 |
#include "CDatatypeRealValueSpaceMapData.h" |
| 32 |
#include "CDatatypeRealValueSpaceMapArranger.h" |
| 33 |
#include "CClashedDependencyDescriptor.h" |
| 34 |
#include "CDatatypeValueSpaceValuesCounter.h" |
| 35 |
#include "CDatatypeValueSpaceRealValuesCounter.h" |
| 36 |
#include "CDatatypeValueSpaceDependencyCollector.h" |
| 37 |
|
| 38 |
|
| 39 |
// Other includes |
| 40 |
#include "Utilities/Container/CLinker.h" |
| 41 |
|
| 42 |
#include "Reasoner/Ontology/CDatatypeValueSpaceType.h" |
| 43 |
#include "Reasoner/Ontology/CDatatypeValueSpaceRealType.h" |
| 44 |
|
| 45 |
// Logger includes |
| 46 |
#include "Logger/CLogger.h" |
| 47 |
|
| 48 |
|
| 49 |
namespace Konclude { |
| 50 |
|
| 51 |
namespace Reasoner { |
| 52 |
|
| 53 |
using namespace Ontology; |
| 54 |
|
| 55 |
namespace Kernel { |
| 56 |
|
| 57 |
namespace Process { |
| 58 |
|
| 59 |
/*! |
| 60 |
* |
| 61 |
* \class CDatatypeRealValueSpaceMap |
| 62 |
* \author Andreas Steigmiller |
| 63 |
* \version 0.1 |
| 64 |
* \brief TODO |
| 65 |
* |
| 66 |
*/ |
| 67 |
class CDatatypeRealValueSpaceMap : public CPROCESSMAP<CDatatypeRealValueSpaceMapArranger,CDatatypeRealValueSpaceMapData> { |
| 68 |
// public methods |
| 69 |
public: |
| 70 |
//! Constructor |
| 71 |
CDatatypeRealValueSpaceMap(CProcessContext* processContext); |
| 72 |
|
| 73 |
CDatatypeRealValueSpaceMap* initDatatypeRealValueSpaceMap(CDatatypeRealValueSpaceMap* map); |
| 74 |
CDatatypeRealValueSpaceMap* initDatatypeRealValueSpaceMap(CDatatypeValueSpaceRealType* valueSpaceType); |
| 75 |
|
| 76 |
|
| 77 |
bool hasExcludedMinimum(CDataLiteralRealValue* value, bool valueInclusively, CDatatypeRealValueExclusionType* exclusionType); |
| 78 |
bool hasExcludedMaximum(CDataLiteralRealValue* value, bool valueInclusively, CDatatypeRealValueExclusionType* exclusionType); |
| 79 |
|
| 80 |
bool isValueExcluded(CDataLiteralRealValue* value, CDatatypeRealValueExclusionType* exclusionType); |
| 81 |
|
| 82 |
|
| 83 |
bool restrictToValue(CDataLiteralRealValue* value, CDependencyTrackPoint* depTrackPoint); |
| 84 |
|
| 85 |
bool excludeMinimum(CDataLiteralRealValue* value, bool valueInclusively, CDependencyTrackPoint* depTrackPoint); |
| 86 |
bool excludeMaximum(CDataLiteralRealValue* value, bool valueInclusively, CDependencyTrackPoint* depTrackPoint); |
| 87 |
|
| 88 |
bool excludeMinimum(CDataLiteralRealValue* value, bool valueInclusively, CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType); |
| 89 |
bool excludeMaximum(CDataLiteralRealValue* value, bool valueInclusively, CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType); |
| 90 |
|
| 91 |
bool excludeValue(CDataLiteralRealValue* value, CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType = nullptr); |
| 92 |
bool excludeInterval(CDataLiteralRealValue* leftValue, bool leftValueInclusive, CDataLiteralRealValue* rightValue, bool rightValueInclusive, CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType = nullptr); |
| 93 |
bool excludeAll(CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType = nullptr); |
| 94 |
|
| 95 |
|
| 96 |
bool areAllValuesRestricted(CDatatypeRealValueExclusionType* exclusionType); |
| 97 |
|
| 98 |
bool isRestrictedToRationalValues(); |
| 99 |
bool isRestrictedToNonRationalValues(); |
| 100 |
|
| 101 |
bool isRestrictedToDecimalValues(); |
| 102 |
bool isRestrictedToNonDecimalValues(); |
| 103 |
|
| 104 |
bool isRestrictedToIntegerValues(); |
| 105 |
bool isRestrictedToNonIntegerValues(); |
| 106 |
|
| 107 |
bool restrictToIntegerValues(CDependencyTrackPoint* depTrackPoint); |
| 108 |
bool restrictToNonIntegerValues(CDependencyTrackPoint* depTrackPoint); |
| 109 |
|
| 110 |
bool restrictToDecimalValues(CDependencyTrackPoint* depTrackPoint); |
| 111 |
bool restrictToNonDecimalValues(CDependencyTrackPoint* depTrackPoint); |
| 112 |
|
| 113 |
bool restrictToRationalValues(CDependencyTrackPoint* depTrackPoint); |
| 114 |
bool restrictToNonRationalValues(CDependencyTrackPoint* depTrackPoint); |
| 115 |
|
| 116 |
bool testValueSpaceReturnClashed(); |
| 117 |
bool addValueSpaceDependencies(CDatatypeValueSpaceDependencyCollector* depCollector); |
| 118 |
bool addValueSpaceDependencies(CDatatypeValueSpaceDependencyCollector* depCollector, CDatatypeRealValueExclusionType* exclusionType); |
| 119 |
|
| 120 |
|
| 121 |
bool getAbsoluteMinimumValue(CDataLiteralRealValue*& minValue, bool& minValueInclusive, CDependencyTrackPoint** depTrackPoint = nullptr); |
| 122 |
bool getAbsoluteMaximumValue(CDataLiteralRealValue*& maxValue, bool& maxValueInclusive, CDependencyTrackPoint** depTrackPoint = nullptr); |
| 123 |
|
| 124 |
|
| 125 |
bool countAllValues(CDatatypeValueSpaceValuesCounter* counter); |
| 126 |
bool countIntervalValues(CDataLiteralRealValue* leftValue, bool leftValueInclusive, CDataLiteralRealValue* rightValue, bool rightValueInclusive, CDatatypeValueSpaceValuesCounter* counter); |
| 127 |
bool countValueValues(CDataLiteralRealValue* value, CDatatypeValueSpaceValuesCounter* counter); |
| 128 |
|
| 129 |
|
| 130 |
bool addIntervalExclusionDependencies(CDataLiteralRealValue* leftValue, bool leftValueInclusive, CDataLiteralRealValue* rightValue, bool rightValueInclusive, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 131 |
bool addValueExclusionDependencies(CDataLiteralRealValue* value, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 132 |
|
| 133 |
|
| 134 |
bool getNextPossibleDataValue(CDataLiteralRealValue* nextValue, CDataLiteralRealValue* lastValue); |
| 135 |
|
| 136 |
// protected methods |
| 137 |
protected: |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
bool adaptNewRealValueDataToNeighbours(CDatatypeRealValueData* valueData); |
| 142 |
|
| 143 |
CDatatypeRealValueData* getDatatypeRealValueData(CDataLiteralRealValue* value, bool createOrLocalize = false, bool* newValueInsertion = nullptr); |
| 144 |
CDatatypeRealValueData* getDatatypeRealValueData(CDataLiteralRealValue* value, CDatatypeRealValueSpaceMapData& valueMapData, bool createOrLocalize, bool* newValueInsertion); |
| 145 |
|
| 146 |
bool isDataIntervalExcluded(CDatatypeRealValueData* leftValueExcluded, CDatatypeRealValueData* rightValueExcluded, CDatatypeRealValueExclusionType* exclusionType); |
| 147 |
bool isDataIntervalExcluded(CDataLiteralRealValue* leftValueExcluded, CDatatypeRealValueData* rightValueExcluded, CDatatypeRealValueExclusionType* exclusionType); |
| 148 |
bool isDataIntervalExcluded(CDatatypeRealValueData* leftValueExcluded, CDataLiteralRealValue* rightValueExcluded, CDatatypeRealValueExclusionType* exclusionType); |
| 149 |
|
| 150 |
bool containsIntervalIntegers(CDataLiteralRealValue* leftValueExcluded, CDataLiteralRealValue* rightValueExcluded, cint64 requiredIntegerCount = 1); |
| 151 |
|
| 152 |
bool isLeftDataIntervalExcluded(CDatatypeRealValueData* dataValue, CDatatypeRealValueExclusionType* exclusionType); |
| 153 |
bool isRightDataIntervalExcluded(CDatatypeRealValueData* dataValue, CDatatypeRealValueExclusionType* exclusionType); |
| 154 |
|
| 155 |
bool isDataValueExcluded(CDatatypeRealValueData* dataValue, CDatatypeRealValueExclusionType* exclusionType); |
| 156 |
bool isDataValueExcluded(CDataLiteralRealValue* dataValue, CDatatypeRealValueExclusionType* exclusionType); |
| 157 |
|
| 158 |
|
| 159 |
bool excludeData(CDatatypeRealValueDataExclusion* exlcusionData, CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType, bool force); |
| 160 |
bool excludeDataValue(CDatatypeRealValueData* dataValue, CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType, bool force); |
| 161 |
bool excludeLeftDataInterval(CDatatypeRealValueData* dataValue, CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType, bool force); |
| 162 |
bool excludeRightDataInterval(CDatatypeRealValueData* dataValue, CDependencyTrackPoint* depTrackPoint, CDatatypeRealValueExclusionType* exclusionType, bool force); |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
bool addDataValueExclusionDependencies(CDatatypeRealValueData* dataValue, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 168 |
bool addDataIntervalExclusionDependencies(CDatatypeRealValueData* leftValueExcluded, CDatatypeRealValueData* rightValueExcluded, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 169 |
|
| 170 |
bool addLeftIntervalExclusionDependencies(CDatatypeRealValueData* valueData, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 171 |
bool addRightIntervalExclusionDependencies(CDatatypeRealValueData* valueData, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 172 |
bool addExclusionDependencies(CDatatypeRealValueDataExclusion* exclusionData, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
bool countDataIntervalValues(CDataLiteralRealValue* leftValueExcluded, CDataLiteralRealValue* rightValueExcluded, CDatatypeRealValueDataExclusion* exlcusionData, CDatatypeValueSpaceValuesCounter* counter); |
| 177 |
bool countDataIntervalValues(CDatatypeRealValueData* leftValueExcluded, CDatatypeRealValueData* rightValueExcluded, CDatatypeValueSpaceValuesCounter* counter); |
| 178 |
bool countDataIntervalValues(CDataLiteralRealValue* leftValueExcluded, CDatatypeRealValueData* rightValueExcluded, CDatatypeValueSpaceValuesCounter* counter); |
| 179 |
bool countDataIntervalValues(CDatatypeRealValueData* leftValueExcluded, CDataLiteralRealValue* rightValueExcluded, CDatatypeValueSpaceValuesCounter* counter); |
| 180 |
|
| 181 |
bool countDataValue(CDataLiteralRealValue* value, CDatatypeRealValueDataExclusion* exlcusionData, CDatatypeValueSpaceValuesCounter* counter); |
| 182 |
bool countDataValue(CDatatypeRealValueData* dataValue, CDatatypeValueSpaceValuesCounter* counter); |
| 183 |
|
| 184 |
// protected variables |
| 185 |
protected: |
| 186 |
CProcessContext* mProcessContext; |
| 187 |
|
| 188 |
CDatatypeRealValueData* mAbsoluteMinimumExclusionValue; |
| 189 |
CDatatypeRealValueData* mAbsoluteMaximumExclusionValue; |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
// private methods |
| 194 |
private: |
| 195 |
|
| 196 |
// private variables |
| 197 |
private: |
| 198 |
|
| 199 |
}; |
| 200 |
|
| 201 |
}; // end namespace Process |
| 202 |
|
| 203 |
}; // end namespace Kernel |
| 204 |
|
| 205 |
}; // end namespace Reasoner |
| 206 |
|
| 207 |
}; // end namespace Konclude |
| 208 |
|
| 209 |
#endif // KONCLUDE_REASONER_KERNEL_PROCESS_CDATATYPEREALVALUESPACEMAP_H |