Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_DATASTRUCTURES_CHARGEPAIR_H
00036 #define OPENMS_DATASTRUCTURES_CHARGEPAIR_H
00037
00038 #include <iostream>
00039 #include <vector>
00040
00041 #include <OpenMS/KERNEL/FeatureMap.h>
00042 #include <OpenMS/DATASTRUCTURES/Compomer.h>
00043
00044 namespace OpenMS
00045 {
00046
00057 class OPENMS_DLLAPI ChargePair
00058 {
00059
00060 public:
00062
00063
00064 ChargePair() :
00065 feature0_index_(0),
00066 feature1_index_(0),
00067 feature0_charge_(0),
00068 feature1_charge_(0),
00069 compomer_(),
00070 mass_diff_(0),
00071 score_(1),
00072 is_active_(false)
00073 {
00074 }
00075
00077 ChargePair(const Size & index0,
00078 const Size & index1,
00079 const Int & charge0,
00080 const Int & charge1,
00081 const Compomer & compomer,
00082 const DoubleReal & mass_diff,
00083 const bool active) :
00084 feature0_index_(index0),
00085 feature1_index_(index1),
00086 feature0_charge_(charge0),
00087 feature1_charge_(charge1),
00088 compomer_(compomer),
00089 mass_diff_(mass_diff),
00090 score_(1),
00091 is_active_(active)
00092 {
00093 }
00094
00096 ChargePair(const ChargePair & rhs) :
00097 feature0_index_(rhs.feature0_index_),
00098 feature1_index_(rhs.feature1_index_),
00099 feature0_charge_(rhs.feature0_charge_),
00100 feature1_charge_(rhs.feature1_charge_),
00101 compomer_(rhs.compomer_),
00102 mass_diff_(rhs.mass_diff_),
00103 score_(rhs.score_),
00104 is_active_(rhs.is_active_)
00105 {
00106 }
00107
00109 ChargePair & operator=(const ChargePair & rhs)
00110 {
00111 if (&rhs == this) return *this;
00112
00113 feature0_index_ = rhs.feature0_index_;
00114 feature1_index_ = rhs.feature1_index_;
00115 feature0_charge_ = rhs.feature0_charge_;
00116 feature1_charge_ = rhs.feature1_charge_;
00117 compomer_ = rhs.compomer_;
00118 mass_diff_ = rhs.mass_diff_;
00119 score_ = rhs.score_;
00120 is_active_ = rhs.is_active_;
00121
00122 return *this;
00123 }
00124
00126 virtual ~ChargePair()
00127 {
00128 }
00129
00131
00132
00134
00135 Int getCharge(UInt pairID) const
00136 {
00137 if (pairID == 0) return feature0_charge_;
00138 else return feature1_charge_;
00139 }
00140
00142 void setCharge(UInt pairID, Int e)
00143 {
00144 if (pairID == 0) feature0_charge_ = e;
00145 else feature1_charge_ = e;
00146 }
00147
00149 Size getElementIndex(UInt pairID) const
00150 {
00151 if (pairID == 0) return feature0_index_;
00152 else return feature1_index_;
00153 }
00154
00156 void setElementIndex(UInt pairID, Size e)
00157 {
00158 if (pairID == 0) feature0_index_ = e;
00159 else feature1_index_ = e;
00160 }
00161
00163 const Compomer & getCompomer() const
00164 {
00165 return compomer_;
00166 }
00167
00169 void setCompomer(const Compomer & compomer)
00170 {
00171 compomer_ = compomer;
00172 }
00173
00175 DoubleReal getMassDiff() const
00176 {
00177 return mass_diff_;
00178 }
00179
00181 void setMassDiff(DoubleReal mass_diff)
00182 {
00183 mass_diff_ = mass_diff;
00184 }
00185
00187 DoubleReal getEdgeScore() const
00188 {
00189 return score_;
00190 }
00191
00193 void setEdgeScore(DoubleReal score)
00194 {
00195 score_ = score;
00196 }
00197
00199 bool isActive() const
00200 {
00201 return is_active_;
00202 }
00203
00204 void setActive(const bool active)
00205 {
00206 is_active_ = active;
00207 }
00208
00210
00212 virtual bool operator==(const ChargePair & i) const
00213 {
00214 return (feature0_index_ == i.feature0_index_) &&
00215 (feature1_index_ == i.feature1_index_) &&
00216 (feature0_charge_ == i.feature0_charge_) &&
00217 (feature1_charge_ == i.feature1_charge_) &&
00218 (compomer_ == i.compomer_) &&
00219 (mass_diff_ == i.mass_diff_) &&
00220 (is_active_ == i.is_active_);
00221 }
00222
00224 virtual bool operator!=(const ChargePair & i) const
00225 {
00226 return !(this->operator==(i));
00227 }
00228
00229 protected:
00230
00232 Size feature0_index_;
00234 Size feature1_index_;
00236 Int feature0_charge_;
00238 Int feature1_charge_;
00240 Compomer compomer_;
00242 DoubleReal mass_diff_;
00244 DoubleReal score_;
00246 bool is_active_;
00247 };
00248
00250 OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const ChargePair & cons);
00251
00252 }
00253
00254 #endif // OPENMS_DATASTRUCTURES_CHARGEPAIR_H