Debian Codegraph @

Source/Reasoner/Answerer/CMappingsInstancesComputationMode.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 "CMappingsInstancesComputationMode.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Answerer {
29
30
31 CMappingsInstancesComputationMode::CMappingsInstancesComputationMode(cint64 mode, cint64 sizeLimit) {
32 mComputationMode = mode;
33 mComputationSizeLimit = sizeLimit;
34 }
35
36
37
38 bool CMappingsInstancesComputationMode::hasComputationMode(CMappingsInstancesComputationMode* mode) {
39 return hasComputationMode(mode->getVariableMappingsComputationMode(), mode->mComputationSizeLimit);
40 }
41
42 CMappingsInstancesComputationMode* CMappingsInstancesComputationMode::setComputationMode(CMappingsInstancesComputationMode* mode) {
43 return setComputationMode(mode->getVariableMappingsComputationMode());
44 }
45
46 CMappingsInstancesComputationMode* CMappingsInstancesComputationMode::addComputationMode(CMappingsInstancesComputationMode* mode) {
47 return addComputationMode(mode->getVariableMappingsComputationMode());
48 }
49
50
51 bool CMappingsInstancesComputationMode::hasALLComputationMode() {
52 return hasComputationMode(COMPUTATION_TYPEF_ALL, -1);
53 }
54
55
56 bool CMappingsInstancesComputationMode::hasComputationMode(cint64 mode) {
57 return mComputationMode & mode != mode;
58 }
59
60 bool CMappingsInstancesComputationMode::hasComputationMode(cint64 mode, cint64 limit) {
61 if (mComputationMode & mode != mode) {
62 return false;
63 }
64 if (limit < 0 && mComputationSizeLimit > 0) {
65 return false;
66 }
67 if (limit >= 0 && mComputationSizeLimit >= 0) {
68 return mComputationSizeLimit > limit;
69 }
70 return true;
71 }
72
73 cint64 CMappingsInstancesComputationMode::getVariableMappingsComputationMode() {
74 return mComputationMode;
75 }
76
77 CMappingsInstancesComputationMode* CMappingsInstancesComputationMode::setComputationMode(cint64 mode) {
78 mComputationMode = mode;
79 return this;
80 }
81
82 CMappingsInstancesComputationMode* CMappingsInstancesComputationMode::addComputationMode(cint64 mode) {
83 mComputationMode |= mode;
84 return this;
85 }
86
87
88 cint64 CMappingsInstancesComputationMode::getComputationSizeLimit() {
89 return mComputationSizeLimit;
90 }
91
92 CMappingsInstancesComputationMode* CMappingsInstancesComputationMode::setComputationSizeLimit(cint64 limit) {
93 mComputationSizeLimit = limit;
94 return this;
95 }
96
97
98 }; // end namespace Answerer
99
100 }; // end namespace Reasoner
101
102 }; // end namespace Konclude