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
27namespace pappso
28{
29
33
38
42
43
44void
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
80void
82{
83 m_grpSubGroupPtrList.remove(p_remove_sub_group);
84}
85
86bool
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}
109void
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
135const QString
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
void remove(GrpSubGroup *p_remove_sub_group)
bool contains(GrpSubGroup *get) const
void add(GrpSubGroup *p_add_sub_group)
const QString printInfos() const
void addAll(const GrpSubGroupSet &other)
std::list< GrpSubGroup * > m_grpSubGroupPtrList
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39