Debian Codegraph @

Source/Reasoner/Kernel/Process/CSignatureBlockingReviewDataIterator.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 "CSignatureBlockingReviewDataIterator.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Process {
31
32
33 CSignatureBlockingReviewDataIterator::CSignatureBlockingReviewDataIterator(CPROCESSSET<cint64>* individualSet, CPROCESSMAP<cint64,cint64>* depthIndividualMap)
34 : mIndividualSet(individualSet), mDepthIndividualMap(depthIndividualMap) {
35
36 mDepthIndividualMapIt = mDepthIndividualMap->begin();
37 mDepthIndividualMapItEnd = mDepthIndividualMap->end();
38
39 while (mDepthIndividualMapIt != mDepthIndividualMapItEnd) {
40 cint64 indiID = mDepthIndividualMapIt.value();
41 if (mIndividualSet->contains(indiID)) {
42 break;
43 } else {
44 mDepthIndividualMapIt = mDepthIndividualMap->erase(mDepthIndividualMapIt);
45 }
46 }
47 }
48
49
50 bool CSignatureBlockingReviewDataIterator::hasNext() {
51 return mDepthIndividualMapIt != mDepthIndividualMapItEnd;
52 }
53
54
55 bool CSignatureBlockingReviewDataIterator::removeAndMoveNext() {
56 if (mDepthIndividualMapIt != mDepthIndividualMapItEnd) {
57 cint64 indiID = mDepthIndividualMapIt.value();
58 mIndividualSet->remove(indiID);
59 mDepthIndividualMapIt = mDepthIndividualMap->erase(mDepthIndividualMapIt);
60
61 while (mDepthIndividualMapIt != mDepthIndividualMapItEnd) {
62 cint64 indiID = mDepthIndividualMapIt.value();
63 if (mIndividualSet->contains(indiID)) {
64 break;
65 } else {
66 mDepthIndividualMapIt = mDepthIndividualMap->erase(mDepthIndividualMapIt);
67 }
68 }
69 return true;
70 }
71 return false;
72 }
73
74
75 cint64 CSignatureBlockingReviewDataIterator::next(bool moveNext) {
76 cint64 indiID = -1;
77 if (mDepthIndividualMapIt != mDepthIndividualMapItEnd) {
78 indiID = mDepthIndividualMapIt.value();
79 if (moveNext) {
80 while (mDepthIndividualMapIt != mDepthIndividualMapItEnd) {
81 cint64 indiID = mDepthIndividualMapIt.value();
82 if (mIndividualSet->contains(indiID)) {
83 break;
84 } else {
85 mDepthIndividualMapIt = mDepthIndividualMap->erase(mDepthIndividualMapIt);
86 }
87 }
88 }
89 }
90 return indiID;
91 }
92
93 }; // end namespace Process
94
95 }; // end namespace Kernel
96
97 }; // end namespace Reasoner
98
99 }; // end namespace Konclude