| | |
The Isotope class models an isotope. More...
| Header: | #include <MsXpS/libXpertMassCore/Isotope.hpp> |
| Inherits: | QObject |
|
| Isotope(QObject *parent = nullptr) | |
| Isotope(const MsXpS::libXpertMassCore::Isotope *other_p, QObject *parent = nullptr) | |
| Isotope(const QString &text, QObject *parent = nullptr) | |
| Isotope(const QString &name, const QString &symbol, double mass, double probability, QObject *parent = nullptr) | |
| Isotope(const MsXpS::libXpertMassCore::Isotope &other, QObject *parent = nullptr) | |
| virtual | ~Isotope() |
| void | clear() |
| MsXpS::libXpertMassCore::Isotope * | clone(QObject *parent = nullptr) const |
| double | getMass() const |
| QString | getName() const |
| double | getProbability() const |
| QString | getSymbol() const |
| bool | initialize(const QString &text) |
| bool | initialize(const QString &name, const QString &symbol, double mass, double probability) |
| bool | initializeVersion1(const QString &text) |
| bool | initializeVersion2(const QString &text) |
| bool | isValid() const |
| void | setMass(double mass) |
| void | setName(const QString &name) |
| void | setProbability(double probability) |
| void | setSymbol(const QString &symbol) |
| QString | toString() const |
| bool | validate(MsXpS::libXpertMassCore::ErrorList *error_list_p) |
| bool | operator!=(const MsXpS::libXpertMassCore::Isotope &other) const |
| bool | operator==(const MsXpS::libXpertMassCore::Isotope &other) const |
| MsXpS::libXpertMassCore::Isotope * | clone(const MsXpS::libXpertMassCore::Isotope &other, QObject *parent = nullptr) |
| bool | m_isValid |
| double | m_mass |
| QString | m_name |
| double | m_probability |
| QString | m_symbol |
The Isotope class models an Isotope by featuring all the methods and member data required to fully characterize an isotope. The member data in this class have been inspired by the element tables from the IsoSpec library. Please, see https://github.com/MatteoLacki/IsoSpec/.
[read-only] isValid : const boolThis property holds the validity status of this isotope.
Access functions:
| bool | isValid() const |
See also validate().
This property holds the mass of this isotope.
Cannot be negative.
Access functions:
This property holds the element name, like "carbon" or "nitrogen" (lowercase).
Access functions:
This property holds the probability of this isotope, that is, its abundance.
Cannot be negative nor superior to 1.
Access functions:
| double | getProbability() const |
| void | setProbability(double probability) |
This property holds the element symbol, like "C" or "N".
Access functions:
Constructs an absolutely empty Isotope.
The Isotope instance is invalid. It can be later intialized with the setter functions or the initialization functions.
See also initialize(const QString &) and initialize(const QString &name, const QString &symbol, double mass, double probability).
Constructs the Isotope as a copy of other_p, setting parent to parent.
This is an overloaded function.
Isotope::Isotope(const QString &text, QObject *parent)
Constructs this Isotope using all the data in the text string, setting parent to parent.
The string contains all the Isotope data, separated by a comma ',' exactly with the same format as that implemented by Isotope::toString().
This is an overloaded function.
See also initialize(const QString &), initialize(const QString &name, const QString &symbol, double mass, double probability), and toString().
Constructs the Isotope with all the required arguments.
The isotope is created as a fully documented instance if all the following parameters are correctly set:
This is an overloaded function.
See also initialize(const QString &name, const QString &symbol, double mass, double probability).
Constructs the Isotope as a copy of other setting parent to parent.
This is an overloaded function.
[virtual noexcept] Isotope::~Isotope()Destructs this Isotope.
Resets all the member data to default invalid values.
The m_isValid member datum is set to false.
Returns a heap-allocated Isotope as a copy of this Isotope but reparented with parent.
Each member datum in this Isotope is copied the returned Isotope, effectivaly making a copy of this Isotope and returning it after reparenting to parent.
[static] MsXpS::libXpertMassCore::Isotope *Isotope::clone(const MsXpS::libXpertMassCore::Isotope &other, QObject *parent = nullptr)Returns a heap-allocated Isotope as a copy of other but reparented with parent.
Each member datum in other is copied the returned Isotope, effectivaly making a copy of other and returning it after reparenting to parent.
Returns the isotope's mass.
Note: Getter function for property mass.
See also setMass().
Returns the isotope's mass.
Note: Getter function for property name.
See also setName().
Returns the isotope's probability (the abundance).
Note: Getter function for property probability.
See also setProbability().
Returns the isotope's symbol.
Note: Getter function for property symbol.
See also setSymbol().
Initializes the Isotope using all the data in the text string.
The string passed as argument is QString::simplified() and QString::split() with ',' as the delimiter.
The obtained strings are converted to the corresponding numerical or textual values to initalize all the member data.
Returns true if the string contained valid substrings that successfully initialized the Isotope, false otherwise.
See also Isotope(const QString &text, QObject *parent) and initialize(const QString &name, const QString &symbol, double mass, double probability).
const QString &symbol, double mass, double probability)
Initializes this Isotope instance using name, symbol, mass and probability.
Returns true if initilization was without error, false otherwise.
This function overloads MsXpS::libXpertMassCore::initialize(const QString &name,.
See also initialize(const QString &text).
Initializes the Isotope using all the data in the text string.
The string passed as argument is QString::simplified() and QString::split() with ',' as the delimiter.
The index of the substring in the string list obtained by splitting the initial text at ',' delimiter defines what data element it corresponds to.
The obtained strings are converted to the corresponding numerical or textual values to initalize all the member data.
Returns true if the string contained valid substrings that successfully initialized the Isotope, false otherwise.
See also Isotope(const QString &text, QObject *parent) and initialize(const QString &name, const QString &symbol, double mass, double probability).
Initializes the Isotope using all the data in the text string.
The string passed as argument is QString::simplified() and QString::split() with ',' as the delimiter.
The index of the substring in the string list obtained by splitting the initial text at ',' delimiter defines what data element it corresponds to.
Returns true if the string contained valid substrings that successfully initialized the Isotope, false otherwise.
See also Isotope(const QString &text, QObject *parent) and initialize(const QString &name, const QString &symbol, double mass, double probability).
Return the member datum m_isValid.
Note: Getter function for property isValid.
Sets the the mass of the isotope to mass.
Note: Setter function for property mass.
See also getMass().
Sets the name of the isotope to name.
Note: Setter function for property name.
See also getName().
Sets the probability (the abundance) of the isotope to probability.
Note: Setter function for property probability.
See also getProbability().
Sets the symbol of the isotope to symbol.
Note: Setter function for property symbol.
See also getSymbol().
Returns a string containing a comma-separated textual representation of all the member data values.
All the member data values are separated using commas ','. Only the values are stored in the string, without naming the variables:
return QString("%1,%2,%3,%4") .arg(m_name) .arg(m_symbol) .arg(m_mass, 0, 'f', 60) .arg(m_probability, 0, 'f', 60);
Validates the isotope.
The element name, symbol, mass and probability member data are scrutinized and if errors are detected descriptive error messages are added to error_list_p.
For example, for symbol:
if(m_symbol.isEmpty()) { local_text = m_symbol.simplified(); regexp.setPattern("^[A-Z][a-z]*$"); if(!regexp.match(local_text).hasMatch()) { error_msg = "Failed to validate the element's symbol."; error_list_p->push_back(error_msg); qDebug() << error_msg; } }
Returns the error count. If no error occurred, the returned value is 0.
Tests the inequality between this isotope and other.
Returns the negated result of operator==().
See also operator==().
Tests the equality between this isotope and other.
Each member datum in other is compared to this isotope's member datum. If a difference is detected, a counter is incremented.
Returns true if no difference has been encountered (the counter is 0) and false otherwise.
See also operator!=().
This variable holds the validity status of this isotope.
See also validate().
This variable holds the mass of this isotope.
Cannot be negative.
This variable holds the element name, like "carbon" or "nitrogen" (lowercase).
This variable holds the probability of this isotope, that is, its abundance.
Cannot be negative nor superior to 1.
This variable holds the element symbol, like "C" or "N".