Debian Codegraph @

Source/Reasoner/Kernel/Process/CDatatypeRealValueDataExclusion.cpp

raw
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 "CDatatypeRealValueDataExclusion.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Process {
31
32
33 CDatatypeRealValueDataExclusion::CDatatypeRealValueDataExclusion() {
34 }
35
36
37 CDatatypeRealValueDataExclusion* CDatatypeRealValueDataExclusion::initDataExclusion(CDatatypeRealValueDataExclusion* value) {
38 if (value) {
39 mPosExclusionType = value->mPosExclusionType;
40 mNegExclusionType = value->mNegExclusionType;
41 mPosExclusionDepTrackPoint = value->mPosExclusionDepTrackPoint;
42 mNegExclusionDepTrackPoint = value->mNegExclusionDepTrackPoint;
43 mExcluded = value->mExcluded;
44 mExcludedDepTrackPoint = value->mExcludedDepTrackPoint;
45 } else {
46 mPosExclusionType = CDatatypeRealValueExclusionType::RVET_NOTHING;
47 mNegExclusionType = CDatatypeRealValueExclusionType::RVET_ALL;
48 mPosExclusionDepTrackPoint = nullptr;
49 mNegExclusionDepTrackPoint = nullptr;
50 mExcludedDepTrackPoint = nullptr;
51 mExcluded = false;
52 }
53 return this;
54 }
55
56
57 bool CDatatypeRealValueDataExclusion::isExcluded() {
58 return mExcluded;
59 }
60
61 CDependencyTrackPoint* CDatatypeRealValueDataExclusion::getExcludedDependencyTrackPoint() {
62 return mExcludedDepTrackPoint;
63 }
64
65 CDatatypeRealValueDataExclusion* CDatatypeRealValueDataExclusion::setExcluded(bool excluded) {
66 mExcluded = excluded;
67 return this;
68 }
69
70 CDatatypeRealValueDataExclusion* CDatatypeRealValueDataExclusion::setExcludedDependencyTrackPoint(CDependencyTrackPoint* depTrackPoint) {
71 mExcludedDepTrackPoint = depTrackPoint;
72 return this;
73 }
74
75
76
77 bool CDatatypeRealValueDataExclusion::isSomethingExcluded() {
78 if (isExcluded()) {
79 return true;
80 }
81 if (mPosExclusionType != CDatatypeRealValueExclusionType::RVET_NOTHING || mNegExclusionType != CDatatypeRealValueExclusionType::RVET_ALL) {
82 return true;
83 } else {
84 return false;
85 }
86 }
87
88 bool CDatatypeRealValueDataExclusion::isEverythingExcluded() {
89 if (isExcluded()) {
90 return true;
91 }
92 if ((cint64)mNegExclusionType <= (cint64)mPosExclusionType) {
93 return true;
94 }
95 if (mPosExclusionType == CDatatypeRealValueExclusionType::RVET_ALL || mNegExclusionType == CDatatypeRealValueExclusionType::RVET_NOTHING) {
96 return true;
97 }
98 return false;
99 }
100
101
102
103 bool CDatatypeRealValueDataExclusion::areOnlyIntegerValuesAllowed() {
104 if (isExcluded()) {
105 return false;
106 }
107 if ((cint64)mPosExclusionType == (cint64)CDatatypeRealValueExclusionType::RVET_NOTHING
108 && (cint64)mNegExclusionType == (cint64)CDatatypeRealValueExclusionType::RVET_INTEGER) {
109
110 return true;
111 }
112 return false;
113 }
114
115
116 bool CDatatypeRealValueDataExclusion::areIntegerValuesExcluded() {
117 if (isExcluded()) {
118 return true;
119 }
120 if ((cint64)mPosExclusionType >= (cint64)CDatatypeRealValueExclusionType::RVET_INTEGER) {
121 return true;
122 }
123 if ((cint64)mNegExclusionType < (cint64)CDatatypeRealValueExclusionType::RVET_INTEGER) {
124 return true;
125 }
126 return false;
127 }
128
129
130 bool CDatatypeRealValueDataExclusion::areDecimalValuesExcluded() {
131 if (isExcluded()) {
132 return true;
133 }
134 if ((cint64)mPosExclusionType >= (cint64)CDatatypeRealValueExclusionType::RVET_DECIMAL) {
135 return true;
136 }
137 if ((cint64)mNegExclusionType < (cint64)CDatatypeRealValueExclusionType::RVET_DECIMAL) {
138 return true;
139 }
140 return false;
141 }
142
143
144 bool CDatatypeRealValueDataExclusion::areRationalValuesExcluded() {
145 if (isExcluded()) {
146 return true;
147 }
148 if ((cint64)mPosExclusionType >= (cint64)CDatatypeRealValueExclusionType::RVET_RATIONAL) {
149 return true;
150 }
151 if ((cint64)mNegExclusionType < (cint64)CDatatypeRealValueExclusionType::RVET_RATIONAL) {
152 return true;
153 }
154 return false;
155 }
156
157
158 bool CDatatypeRealValueDataExclusion::areRealValuesExcluded() {
159 if (isExcluded()) {
160 return true;
161 }
162 if ((cint64)mPosExclusionType >= (cint64)CDatatypeRealValueExclusionType::RVET_REAL) {
163 return true;
164 }
165 if ((cint64)mNegExclusionType < (cint64)CDatatypeRealValueExclusionType::RVET_REAL) {
166 return true;
167 }
168 return false;
169 }
170
171
172 bool CDatatypeRealValueDataExclusion::isExcluded(CDatatypeRealValueExclusionType* type) {
173 if (isExcluded()) {
174 return true;
175 }
176 if (type->getExclusionNegation()) {
177 if ((cint64)type->getExclusionType() >= (cint64)mNegExclusionType) {
178 return true;
179 }
180 } else {
181 if ((cint64)type->getExclusionType() <= (cint64)mPosExclusionType) {
182 return true;
183 }
184 }
185 return false;
186 }
187
188 CDatatypeRealValueDataExclusion* CDatatypeRealValueDataExclusion::setExclusion(CDatatypeRealValueExclusionType* type, CDependencyTrackPoint* depTrackPoint) {
189 if (!isExcluded(type)) {
190 if (type->getExclusionNegation()) {
191 mNegExclusionType = type->getExclusionType();
192 mNegExclusionDepTrackPoint = depTrackPoint;
193 } else {
194 mPosExclusionType = type->getExclusionType();
195 mPosExclusionDepTrackPoint = depTrackPoint;
196 }
197 }
198 return this;
199 }
200
201 CDependencyTrackPoint* CDatatypeRealValueDataExclusion::getExclusionDependencyTrackPoint(CDatatypeRealValueExclusionType* type) {
202 if (isExcluded()) {
203 return getExcludedDependencyTrackPoint();
204 }
205 if (!isExcluded(type)) {
206 return nullptr;
207 } else if (type->getExclusionNegation()) {
208 return mNegExclusionDepTrackPoint;
209 } else {
210 return mPosExclusionDepTrackPoint;
211 }
212 return nullptr;
213 }
214
215
216
217 CDependencyTrackPoint* CDatatypeRealValueDataExclusion::getPositiveExclusionDependencyTrackPoint() {
218 return mPosExclusionDepTrackPoint;
219 }
220
221 CDependencyTrackPoint* CDatatypeRealValueDataExclusion::getNegativeExclusionDependencyTrackPoint() {
222 return mNegExclusionDepTrackPoint;
223 }
224
225
226 }; // end namespace Process
227
228 }; // end namespace Kernel
229
230 }; // end namespace Reasoner
231
232 }; // end namespace Konclude