Debian Codegraph @

Source/Reasoner/Ontology/CUnsatisfiableCachingTags.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 "CUnsatisfiableCachingTags.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Ontology {
29
30
31 CUnsatisfiableCachingTags::CUnsatisfiableCachingTags() {
32 mMinUnsatCachedSize = CINT64_MAX;
33 }
34
35 cint64 CUnsatisfiableCachingTags::getMinUnsatisfiableCachedSize() {
36 return mMinUnsatCachedSize;
37 }
38
39 CCachingTags* CUnsatisfiableCachingTags::setMinUnsatisfiableCachedSize(cint64 size) {
40 mMinUnsatCachedSize = size;
41 return this;
42 }
43
44 bool CUnsatisfiableCachingTags::setMinUnsatisfiableCachedSizeCandidate(cint64 size) {
45 if (size < mMinUnsatCachedSize) {
46 mMinUnsatCachedSize = size;
47 return true;
48 }
49 return false;
50 }
51
52 bool CUnsatisfiableCachingTags::updateCachingTags(cint64 cachedTagCandidate, cint64 cachingNumberTag, cint64 sizeCandidate) {
53 bool changed = false;
54 changed |= setMinUnsatisfiableCachedSizeCandidate(sizeCandidate);
55 changed |= setMaxCachedTagCandidate(cachedTagCandidate);
56 changed |= setMinCachedTagCandidate(cachedTagCandidate);
57 setLastCachingTag(cachingNumberTag);
58 return changed;
59 }
60
61
62 bool CUnsatisfiableCachingTags::candidateTags(cint64& minMaxCachedTag, cint64& maxMinCachedTag, cint64& minUnsatCachedSize, cint64 requiredLastCachingTag) {
63 if (mLastCachingTag >= requiredLastCachingTag) {
64 minMaxCachedTag = qMin(minMaxCachedTag,mMaxCachedTag);
65 maxMinCachedTag = qMax(maxMinCachedTag,mMinCachedTag);
66 minUnsatCachedSize = qMin(minUnsatCachedSize,mMinUnsatCachedSize);
67 return true;
68 }
69 return false;
70 }
71
72 bool CUnsatisfiableCachingTags::hasCandidateTags(cint64 minMaxCachedTag, cint64 maxMinCachedTag, cint64 requiredLastCachingTag) {
73 if (mLastCachingTag >= requiredLastCachingTag) {
74 if (minMaxCachedTag == mMaxCachedTag || maxMinCachedTag == mMinCachedTag) {
75 return true;
76 }
77 }
78 return false;
79 }
80
81
82 bool CUnsatisfiableCachingTags::candidateMinUnsatisfiableSize(cint64& minUnsatCachedSize, cint64 cachedTag) {
83 if (mMinCachedTag == cachedTag && mMaxCachedTag == cachedTag) {
84 minUnsatCachedSize = qMin(minUnsatCachedSize,mMinUnsatCachedSize);
85 return true;
86 }
87 return false;
88 }
89
90
91 }; // end namespace Ontology
92
93
94 }; // end namespace Reasoner
95
96 }; // end namespace Konclude