libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::DataPoint Struct Reference

#include <datapoint.h>

Public Member Functions

 DataPoint ()=default
 DataPoint (pappso_double x, pappso_double y)
 DataPoint (std::pair< pappso_double, pappso_double > pair)
 DataPoint (const QString &text)
 DataPoint (const DataPoint &other)
DataPointCstSPtr makeDataPointCstSPtr () const
void initialize (pappso_double x, pappso_double y)
void initialize (const DataPoint &other)
bool initialize (const QString &text)
void reset ()
void incrementX (pappso_double value)
void incrementY (pappso_double value)
bool operator== (const DataPoint &other) const
DataPointoperator= (const DataPoint &other)
bool isValid () const
QString toString () const
QString toString (int decimals) const

Public Attributes

pappso_double x = -1
pappso_double y = 0

Detailed Description

Definition at line 21 of file datapoint.h.

Constructor & Destructor Documentation

◆ DataPoint() [1/5]

◆ DataPoint() [2/5]

pappso::DataPoint::DataPoint ( pappso_double x,
pappso_double y )

Definition at line 34 of file datapoint.cpp.

34 : x(x), y(y)
35{
36}
pappso_double x
Definition datapoint.h:24
pappso_double y
Definition datapoint.h:25

References x, and y.

◆ DataPoint() [3/5]

pappso::DataPoint::DataPoint ( std::pair< pappso_double, pappso_double > pair)

Definition at line 39 of file datapoint.cpp.

39 : x(pair.first), y(pair.second)
40{
41}

References x, and y.

◆ DataPoint() [4/5]

pappso::DataPoint::DataPoint ( const QString & text)

Definition at line 44 of file datapoint.cpp.

45{
46 if(!initialize(text))
47 throw ExceptionNotPossible(
48 "Failed to initialize the DataPoint object using the provided string.");
49}
void initialize(pappso_double x, pappso_double y)
Definition datapoint.cpp:72

References initialize().

◆ DataPoint() [5/5]

pappso::DataPoint::DataPoint ( const DataPoint & other)

Definition at line 51 of file datapoint.cpp.

51 : x(other.x), y(other.y)
52{
53}

References DataPoint(), x, and y.

Member Function Documentation

◆ incrementX()

void pappso::DataPoint::incrementX ( pappso_double value)

Definition at line 176 of file datapoint.cpp.

177{
178 x += value;
179}

References x.

Referenced by DataPoint().

◆ incrementY()

void pappso::DataPoint::incrementY ( pappso_double value)

Definition at line 183 of file datapoint.cpp.

184{
185 y += value;
186}

References y.

Referenced by DataPoint().

◆ initialize() [1/3]

void pappso::DataPoint::initialize ( const DataPoint & other)

Definition at line 80 of file datapoint.cpp.

81{
82 x = other.x;
83 y = other.y;
84}

References DataPoint(), x, and y.

◆ initialize() [2/3]

bool pappso::DataPoint::initialize ( const QString & text)

Definition at line 88 of file datapoint.cpp.

89{
90
91 QRegularExpressionMatch regExpMatch;
92
93 regExpMatch = Utils::xyMassDataFormatRegExp.match(text);
94
95 if(!regExpMatch.hasMatch())
96 return false;
97
98 bool ok = false;
99
100 double key = regExpMatch.captured(1).toDouble(&ok);
101
102 if(!ok)
103 return false;
104
105 // Note that group 2 is the separator group.
106
107 double val = regExpMatch.captured(3).toDouble(&ok);
108
109 if(!ok)
110 return false;
111
112 x = key;
113 y = val;
114
115 return true;
116}
static QRegularExpression xyMassDataFormatRegExp
Regular expression matching <numerical value><non-numerical*><numericalvalue>.
Definition utils.h:60

References x, pappso::Utils::xyMassDataFormatRegExp, and y.

◆ initialize() [3/3]

void pappso::DataPoint::initialize ( pappso_double x,
pappso_double y )

Definition at line 72 of file datapoint.cpp.

73{
74 this->x = x;
75 this->y = y;
76}

References x, and y.

Referenced by DataPoint(), and DataPoint().

◆ isValid()

bool pappso::DataPoint::isValid ( ) const

Definition at line 128 of file datapoint.cpp.

129{
130 return (x >= 0);
131}

References x.

Referenced by DataPoint().

◆ makeDataPointCstSPtr()

DataPointCstSPtr pappso::DataPoint::makeDataPointCstSPtr ( ) const

Definition at line 65 of file datapoint.cpp.

66{
67 return std::make_shared<const DataPoint>(*this);
68}

Referenced by DataPoint().

◆ operator=()

DataPoint & pappso::DataPoint::operator= ( const DataPoint & other)

Definition at line 196 of file datapoint.cpp.

197{
198 x = other.x;
199 y = other.y;
200
201 return *this;
202}

References DataPoint(), x, and y.

Referenced by DataPoint().

◆ operator==()

bool pappso::DataPoint::operator== ( const DataPoint & other) const

Definition at line 189 of file datapoint.cpp.

190{
191 return ((x == other.x) && (y == other.y));
192}

References DataPoint(), x, and y.

Referenced by DataPoint().

◆ reset()

void pappso::DataPoint::reset ( )

Definition at line 120 of file datapoint.cpp.

121{
122 x = -1;
123 y = 0;
124}

References x, and y.

Referenced by DataPoint().

◆ toString() [1/2]

QString pappso::DataPoint::toString ( ) const

Definition at line 135 of file datapoint.cpp.

136{
137 return QString("%1 %2").arg(x, 0, 'f', 15).arg(y, 0, 'f', 15);
138}

References x, and y.

Referenced by DataPoint().

◆ toString() [2/2]

QString pappso::DataPoint::toString ( int decimals) const

Definition at line 142 of file datapoint.cpp.

143{
144 return QString("%1 %2").arg(x, 0, 'f', decimals).arg(y, 0, 'f', decimals);
145}

References x, and y.

Member Data Documentation

◆ x

pappso_double pappso::DataPoint::x = -1

Definition at line 24 of file datapoint.h.

Referenced by DataPoint(), DataPoint(), DataPoint(), DataPoint(), pappso::FilterChargeDeconvolution::addDataPointToList(), pappso::QCPSpectrum::addMassDelta(), pappso::QCPSpectrum::addPeakIonIsotopeMatch(), pappso::MsRunRetentionTime< T >::align(), pappso::TimsFrame::combineScansToTraceWithDowngradedMzResolution(), pappso::TimsFrame::combineScansToTraceWithDowngradedMzResolution2(), pappso::Trace::containsX(), pappso::TimsFrame::cumulateScansToTrace(), pappso::Trace::dataPointCstIteratorWithX(), pappso::Trace::dataPointIteratorWithX(), pappso::QCPXic::drawXicPeakBorders(), pappso::MsRunXicExtractor::extractOneXicCoord(), pappso::MsRunXicExtractorDisk::extractOneXicCoord(), pappso::specself::SelfSpectrumDataPoint::fillAntiSpectrumDataPoint(), pappso::specself::SelfSpectrumDataPoint::fillSelfSpectrumDataPoint(), pappso::FilterTandemDeisotope::filter(), pappso::findFirstEqualOrGreaterX(), pappso::findFirstEqualOrGreaterX(), pappso::findFirstGreaterX(), pappso::findFirstGreaterX(), pappso::TimsFrameBase::getIonMobilityTraceByTofIndexRange(), pappso::TimsFrame::getMassSpectrumSPtr(), pappso::TimsFrameType1::getMassSpectrumSPtr(), pappso::QCPSpectrum::getNearestPeakBetween(), pappso::TimsFrame::getRawTraceSPtr(), pappso::TimsFrameType1::getRawTraceSPtr(), pappso::TimsFrameBase::getTraceFromTofIndexIntensityMap(), incrementX(), initialize(), initialize(), initialize(), pappso::MapTrace::insertOrUpdate(), isValid(), pappso::MsRunRetentionTime< T >::linearRegressionMs2toMs1(), pappso::Trace::maxX(), pappso::Trace::minX(), pappso::operator<<(), operator=(), operator==(), pappso::operator>>(), pappso::HighResPeakPicker::pick(), reset(), pappso::FilterTriangle::sumAndRemove(), toString(), toString(), and pappso::masschroq::CborOutputStream::writeTracePeak().

◆ y


The documentation for this struct was generated from the following files: