| 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_ONTOLOGY_CDATALITERALREALVALUE_H |
| 22 |
#define KONCLUDE_REASONER_ONTOLOGY_CDATALITERALREALVALUE_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#include <QString> |
| 26 |
|
| 27 |
|
| 28 |
// Namespace includes |
| 29 |
#include "OntologySettings.h" |
| 30 |
#include "CDataLiteralValue.h" |
| 31 |
#include "CDataLiteralCompareValue.h" |
| 32 |
|
| 33 |
|
| 34 |
// Other includes |
| 35 |
|
| 36 |
|
| 37 |
// Logger includes |
| 38 |
#include "Logger/CLogger.h" |
| 39 |
|
| 40 |
|
| 41 |
namespace Konclude { |
| 42 |
|
| 43 |
namespace Reasoner { |
| 44 |
|
| 45 |
namespace Ontology { |
| 46 |
|
| 47 |
/*! |
| 48 |
* |
| 49 |
* \class CDataLiteralRealValue |
| 50 |
* \author Andreas Steigmiller |
| 51 |
* \version 0.1 |
| 52 |
* \brief TODO |
| 53 |
* |
| 54 |
*/ |
| 55 |
class CDataLiteralRealValue : public CDataLiteralCompareValue { |
| 56 |
// public methods |
| 57 |
public: |
| 58 |
//! Constructor |
| 59 |
CDataLiteralRealValue(); |
| 60 |
|
| 61 |
static const cint64 DLRV_INTEGER_FLAG = 0x01; |
| 62 |
static const cint64 DLRV_DECIMAL_FLAG = 0x02; |
| 63 |
static const cint64 DLRV_RATIONAL_FLAG = 0x04; |
| 64 |
|
| 65 |
virtual CDataLiteralCompareValue* initValue(CDataLiteralCompareValue* value); |
| 66 |
CDataLiteralRealValue* initRationalValueFromInfinite(bool negative); |
| 67 |
CDataLiteralRealValue* initRationalValueFromFraction(cint64 numeratorValue, cint64 denominatorValue); |
| 68 |
CDataLiteralRealValue* initRationalValueFromFraction(cuint64 numeratorValue, cuint64 denominatorValue, bool negative); |
| 69 |
CDataLiteralRealValue* initRationalValueFromDecimal(cint64 integerValue, cint64 decimalValue, cint64 precedingZerors = 0); |
| 70 |
CDataLiteralRealValue* initRationalValueFromDecimal(cuint64 integerValue, cuint64 decimalValue, bool negative, cint64 precedingZerors = 0); |
| 71 |
CDataLiteralRealValue* initRationalValueFromInteger(cint64 value); |
| 72 |
CDataLiteralRealValue* initRationalValueFromInteger(cuint64 value, bool negation); |
| 73 |
|
| 74 |
CDataLiteralRealValue* initRationalValueFromNextIntegerValue(CDataLiteralRealValue* value); |
| 75 |
|
| 76 |
CDataLiteralRealValue* initValue(CDataLiteralRealValue* value); |
| 77 |
|
| 78 |
CDataLiteralRealValue* clearValue(); |
| 79 |
CDataLiteralRealValue* clearFlags(); |
| 80 |
|
| 81 |
|
| 82 |
virtual QString getValueString(); |
| 83 |
|
| 84 |
bool hasFlag(cint64 flag); |
| 85 |
|
| 86 |
|
| 87 |
virtual DATA_LITERAL_VALUE_TYPE getDataValueType(); |
| 88 |
|
| 89 |
bool isNegative(); |
| 90 |
bool isInfinite(); |
| 91 |
cuint64 getInteger(); |
| 92 |
cuint64 getNumerator(); |
| 93 |
cuint64 getDenominator(); |
| 94 |
|
| 95 |
bool isInfiniteBigNumber(); |
| 96 |
|
| 97 |
cint64 getPosNegInteger(); |
| 98 |
|
| 99 |
|
| 100 |
CDataLiteralRealValue* setNegative(bool negative); |
| 101 |
CDataLiteralRealValue* setInteger(cuint64 integer); |
| 102 |
CDataLiteralRealValue* setNumerator(cuint64 numerator); |
| 103 |
CDataLiteralRealValue* setDenominator(cuint64 denominator); |
| 104 |
|
| 105 |
|
| 106 |
bool isEqualTo(CDataLiteralValue* value); |
| 107 |
|
| 108 |
bool isLessEqualThan(CDataLiteralCompareValue* value); |
| 109 |
bool isLessThan(CDataLiteralCompareValue* value); |
| 110 |
bool isEqualTo(CDataLiteralCompareValue* value); |
| 111 |
bool isGreaterEqualThan(CDataLiteralCompareValue* value); |
| 112 |
bool isGreaterThan(CDataLiteralCompareValue* value); |
| 113 |
|
| 114 |
bool isLessEqualThan(CDataLiteralRealValue* value); |
| 115 |
bool isLessThan(CDataLiteralRealValue* value); |
| 116 |
bool isEqualTo(CDataLiteralRealValue* value); |
| 117 |
bool isGreaterEqualThan(CDataLiteralRealValue* value); |
| 118 |
bool isGreaterThan(CDataLiteralRealValue* value); |
| 119 |
|
| 120 |
|
| 121 |
// protected methods |
| 122 |
protected: |
| 123 |
CDataLiteralRealValue* identifyFlags(); |
| 124 |
bool normalize(); |
| 125 |
|
| 126 |
// protected variables |
| 127 |
protected: |
| 128 |
bool mNegative; |
| 129 |
bool mInfinite; |
| 130 |
cuint64 mInteger; |
| 131 |
cuint64 mNumerator; |
| 132 |
cuint64 mDenominator; |
| 133 |
|
| 134 |
cint64 mFlags; |
| 135 |
|
| 136 |
// private methods |
| 137 |
private: |
| 138 |
|
| 139 |
// private variables |
| 140 |
private: |
| 141 |
|
| 142 |
}; |
| 143 |
|
| 144 |
}; // end namespace Ontology |
| 145 |
|
| 146 |
}; // end namespace Reasoner |
| 147 |
|
| 148 |
}; // end namespace Konclude |
| 149 |
|
| 150 |
#endif // KONCLUDE_REASONER_ONTOLOGY_CDATALITERALREALVALUE_H |