Debian Codegraph @

Source/Reasoner/Kernel/Process/CDatatypeStringValueDataExclusion.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 "CDatatypeStringValueDataExclusion.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Process {
31
32
33 CDatatypeStringValueDataExclusion::CDatatypeStringValueDataExclusion() {
34 }
35
36
37 CDatatypeStringValueDataExclusion* CDatatypeStringValueDataExclusion::initDataExclusion(CDatatypeStringValueDataExclusion* 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 = CDatatypeStringValueExclusionType::SVET_NOTHING;
47 mNegExclusionType = CDatatypeStringValueExclusionType::SVET_ALL;
48 mPosExclusionDepTrackPoint = nullptr;
49 mNegExclusionDepTrackPoint = nullptr;
50 mExcludedDepTrackPoint = nullptr;
51 mExcluded = false;
52 }
53 return this;
54 }
55
56
57 bool CDatatypeStringValueDataExclusion::isExcluded() {
58 return mExcluded;
59 }
60
61 CDependencyTrackPoint* CDatatypeStringValueDataExclusion::getExcludedDependencyTrackPoint() {
62 return mExcludedDepTrackPoint;
63 }
64
65 CDatatypeStringValueDataExclusion* CDatatypeStringValueDataExclusion::setExcluded(bool excluded) {
66 mExcluded = excluded;
67 return this;
68 }
69
70 CDatatypeStringValueDataExclusion* CDatatypeStringValueDataExclusion::setExcludedDependencyTrackPoint(CDependencyTrackPoint* depTrackPoint) {
71 mExcludedDepTrackPoint = depTrackPoint;
72 return this;
73 }
74
75
76
77 bool CDatatypeStringValueDataExclusion::isSomethingExcluded() {
78 if (isExcluded()) {
79 return true;
80 }
81 if (mPosExclusionType != CDatatypeStringValueExclusionType::SVET_NOTHING || mNegExclusionType != CDatatypeStringValueExclusionType::SVET_ALL) {
82 return true;
83 } else {
84 return false;
85 }
86 }
87
88 bool CDatatypeStringValueDataExclusion::isEverythingExcluded() {
89 if (isExcluded()) {
90 return true;
91 }
92 if ((cint64)mNegExclusionType <= (cint64)mPosExclusionType) {
93 return true;
94 }
95 if (mPosExclusionType == CDatatypeStringValueExclusionType::SVET_ALL || mNegExclusionType == CDatatypeStringValueExclusionType::SVET_NOTHING) {
96 return true;
97 }
98 return false;
99 }
100
101
102
103 bool CDatatypeStringValueDataExclusion::areOnlyLanguageTagsAllowed() {
104 if (isExcluded()) {
105 return false;
106 }
107 if ((cint64)mPosExclusionType == (cint64)CDatatypeStringValueExclusionType::SVET_NOTHING
108 && (cint64)mNegExclusionType == (cint64)CDatatypeStringValueExclusionType::SVET_LANGUAGE_TAGS_COMPLETELY) {
109
110 return true;
111 }
112 return false;
113 }
114
115
116 bool CDatatypeStringValueDataExclusion::areLanguageTagsExcluded() {
117 if (isExcluded()) {
118 return true;
119 }
120 if ((cint64)mPosExclusionType >= (cint64)CDatatypeStringValueExclusionType::SVET_LANGUAGE_TAGS_COMPLETELY) {
121 return true;
122 }
123 if ((cint64)mNegExclusionType < (cint64)CDatatypeStringValueExclusionType::SVET_LANGUAGE_TAGS_COMPLETELY) {
124 return true;
125 }
126 return false;
127 }
128
129
130 bool CDatatypeStringValueDataExclusion::isExcluded(CDatatypeStringValueExclusionType* type) {
131 if (isExcluded()) {
132 return true;
133 }
134 if (type->getExclusionNegation()) {
135 if ((cint64)type->getExclusionType() >= (cint64)mNegExclusionType) {
136 return true;
137 }
138 } else {
139 if ((cint64)type->getExclusionType() <= (cint64)mPosExclusionType) {
140 return true;
141 }
142 }
143 return false;
144 }
145
146
147 CDatatypeStringValueDataExclusion* CDatatypeStringValueDataExclusion::setExclusion(CDatatypeStringValueExclusionType* type, CDependencyTrackPoint* depTrackPoint) {
148 if (!isExcluded(type)) {
149 if (type->getExclusionNegation()) {
150 mNegExclusionType = type->getExclusionType();
151 mNegExclusionDepTrackPoint = depTrackPoint;
152 } else {
153 mPosExclusionType = type->getExclusionType();
154 mPosExclusionDepTrackPoint = depTrackPoint;
155 }
156 }
157 return this;
158 }
159
160 CDependencyTrackPoint* CDatatypeStringValueDataExclusion::getExclusionDependencyTrackPoint(CDatatypeStringValueExclusionType* type) {
161 if (isExcluded()) {
162 return getExcludedDependencyTrackPoint();
163 }
164 if (!isExcluded(type)) {
165 return nullptr;
166 } else if (type->getExclusionNegation()) {
167 return mNegExclusionDepTrackPoint;
168 } else {
169 return mPosExclusionDepTrackPoint;
170 }
171 return nullptr;
172 }
173
174
175
176 CDependencyTrackPoint* CDatatypeStringValueDataExclusion::getPositiveExclusionDependencyTrackPoint() {
177 return mPosExclusionDepTrackPoint;
178 }
179
180 CDependencyTrackPoint* CDatatypeStringValueDataExclusion::getNegativeExclusionDependencyTrackPoint() {
181 return mNegExclusionDepTrackPoint;
182 }
183
184
185 }; // end namespace Process
186
187 }; // end namespace Kernel
188
189 }; // end namespace Reasoner
190
191 }; // end namespace Konclude