libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
grpsubgroupset.cpp
Go to the documentation of this file.
1
2
/*******************************************************************************
3
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
4
*
5
* This file is part of the PAPPSOms++ library.
6
*
7
* PAPPSOms++ is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* PAPPSOms++ is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
19
*
20
* Contributors:
21
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
22
*implementation
23
******************************************************************************/
24
25
#include "
grpsubgroupset.h
"
26
27
namespace
pappso
28
{
29
30
GrpSubGroupSet::GrpSubGroupSet
()
31
{
32
}
33
34
GrpSubGroupSet::GrpSubGroupSet
(
const
GrpSubGroupSet
&other)
35
:
m_grpSubGroupPtrList
(other.
m_grpSubGroupPtrList
)
36
{
37
}
38
39
GrpSubGroupSet::~GrpSubGroupSet
()
40
{
41
}
42
43
44
void
45
GrpSubGroupSet::addAll
(
const
GrpSubGroupSet
&other)
46
{
47
48
std::list<GrpSubGroup *>::iterator it(
m_grpSubGroupPtrList
.begin());
49
std::list<GrpSubGroup *>::iterator itEnd(
m_grpSubGroupPtrList
.end());
50
std::list<GrpSubGroup *>::const_iterator itIn(other.
m_grpSubGroupPtrList
.begin());
51
std::list<GrpSubGroup *>::const_iterator itInEnd(other.
m_grpSubGroupPtrList
.end());
52
53
while
((itIn != itInEnd) && (it != itEnd))
54
{
55
if
(*itIn < *it)
56
{
57
it++;
58
continue
;
59
}
60
if
(*itIn > *it)
61
{
62
it =
m_grpSubGroupPtrList
.insert(it, *itIn);
63
it++;
64
itIn++;
65
continue
;
66
}
67
if
(*itIn == *it)
68
{
69
itIn++;
70
it++;
71
}
72
}
73
while
(itIn != itInEnd)
74
{
75
m_grpSubGroupPtrList
.push_back(*itIn);
76
itIn++;
77
}
78
}
79
80
void
81
GrpSubGroupSet::remove
(
GrpSubGroup
*p_remove_sub_group)
82
{
83
m_grpSubGroupPtrList
.remove(p_remove_sub_group);
84
}
85
86
bool
87
GrpSubGroupSet::contains
(
GrpSubGroup
*p_sub_group)
const
88
{
89
90
std::list<GrpSubGroup *>::const_iterator it(
m_grpSubGroupPtrList
.begin()),
91
itEnd(
m_grpSubGroupPtrList
.end());
92
93
94
while
(it != itEnd)
95
{
96
if
(p_sub_group == *it)
97
{
98
// this subgroup is already in list
99
return
true
;
100
}
101
if
(p_sub_group > *it)
102
{
103
return
false
;
104
}
105
it++;
106
}
107
return
false
;
108
}
109
void
110
GrpSubGroupSet::add
(
GrpSubGroup
*p_add_sub_group)
111
{
112
113
std::list<GrpSubGroup *>::iterator it(
m_grpSubGroupPtrList
.begin()),
114
itEnd(
m_grpSubGroupPtrList
.end());
115
116
117
while
(it != itEnd)
118
{
119
if
(p_add_sub_group == *it)
120
{
121
// this subgroup is already in list
122
return
;
123
}
124
if
(p_add_sub_group > *it)
125
{
126
it =
m_grpSubGroupPtrList
.insert(it, p_add_sub_group);
127
return
;
128
}
129
it++;
130
}
131
m_grpSubGroupPtrList
.push_back(p_add_sub_group);
132
}
133
134
135
const
QString
136
GrpSubGroupSet::printInfos
()
const
137
{
138
QString infos;
139
std::list<GrpSubGroup *>::const_iterator it(
m_grpSubGroupPtrList
.begin()),
140
itEnd(
m_grpSubGroupPtrList
.end());
141
142
143
while
(it != itEnd)
144
{
145
infos.append((*it)->getFirstAccession() +
" "
+
146
QString(
"0x%1"
).arg((quintptr)*it, QT_POINTER_SIZE * 2, 16, QChar(
'0'
)) +
"\n"
);
147
it++;
148
}
149
150
return
infos;
151
}
152
153
}
// namespace pappso
pappso::GrpSubGroupSet::remove
void remove(GrpSubGroup *p_remove_sub_group)
Definition
grpsubgroupset.cpp:81
pappso::GrpSubGroupSet::contains
bool contains(GrpSubGroup *get) const
Definition
grpsubgroupset.cpp:87
pappso::GrpSubGroupSet::~GrpSubGroupSet
~GrpSubGroupSet()
Definition
grpsubgroupset.cpp:39
pappso::GrpSubGroupSet::add
void add(GrpSubGroup *p_add_sub_group)
Definition
grpsubgroupset.cpp:110
pappso::GrpSubGroupSet::printInfos
const QString printInfos() const
Definition
grpsubgroupset.cpp:136
pappso::GrpSubGroupSet::addAll
void addAll(const GrpSubGroupSet &other)
Definition
grpsubgroupset.cpp:45
pappso::GrpSubGroupSet::GrpSubGroupSet
GrpSubGroupSet()
Definition
grpsubgroupset.cpp:30
pappso::GrpSubGroupSet::m_grpSubGroupPtrList
std::list< GrpSubGroup * > m_grpSubGroupPtrList
Definition
grpsubgroupset.h:38
pappso::GrpSubGroup
Definition
grpsubgroup.h:43
grpsubgroupset.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappsomspp
core
grouping
grpsubgroupset.cpp
Generated on
for libpappsomspp by
1.15.0