| | |
The MassCollection class provides a container for masses (as double values) and for text representing thoses values. More...
| Header: | #include <MassCollection.hpp> |
| MassCollection(const QString &name) | |
| MassCollection(const QString &name, const QString &mass_text) | |
| MassCollection(const QString &name, const std::vector<double> &masses) | |
| MassCollection(const MsXpS::libXpertMassCore::MassCollection &other) | |
| ~MassCollection() | |
| void | addMass(double mass) |
| const QString & | getComment() const |
| double | getMassAtIndex(std::size_t index) const |
| const std::vector<double> & | getMassesCstRef() const |
| std::vector<double> & | getMassesRef() |
| const QString & | getName() const |
| bool | isValid() const |
| QString | massesToText() |
| void | removeLessThan(double threshold) |
| void | setComment(const QString &comment) |
| void | setName(const QString &name) |
| std::size_t | size() const |
| void | sortAscending() |
| void | sortDescending() |
| int | textToMasses(const QString &text, MsXpS::libXpertMassCore::ErrorList *error_list_p) |
| bool | validate(MsXpS::libXpertMassCore::ErrorList *error_list_p) const |
| MsXpS::libXpertMassCore::MassCollection & | operator=(const MsXpS::libXpertMassCore::MassCollection &other) |
The MassCollection class provides a container for masses (as double values) and for text representing thoses values. Methods allow to create numerical mass values starting for a text string representing mass values separated by newline characters and, reciprocally, create a text string starting from all the mass values.
The mass values are stored in a container (m_masses) and the text string is stored in m_massText.
Constructs a MassCollection with name.
The instance is created in an invalid state.
Constructs a MassCollection with name and mass_text.
The mass_text is the textual representation of the mass double values that is parsed and converted to mass double values. After the parsing, this instance is validated, and the result is set to m_isValid.
Constructs a MassCollection with name and masses.
The masses are copied to the member container without check. If the masses container is non-empty, the m_isValid status is set to true, else to false.
Constructs a MassCollection as a copy of other. If the masses container is non-empty, the m_isValid status is set to true, else to false.
[noexcept] MassCollection::~MassCollection()Destructs this MassCollection.
Adds mass to each mass in the container.
Returns the comment.
Returns the mass at the index in the container.
An out of bounds index is fatal.
Returns a const reference to the container of masses.
Returns a reference to the container of masses.
Returns the name.
Returns the validity status of this MassCollection.
Returns a text string representing the mass double values in the container all separated with a newline character.
Removes from the container all mass values strictly below threshold.
Sets the comment to comment.
Sets the name to name.
Returns the size of the container of masses.
Sorts the masses in the container in ascending order.
Sorts the masses in the container in descending order.
Returns the count of masses successfully obtained by converting the text to double values.
The text is first split at newline characters and each obtained string is converted to a double value that is added to the container.
The mass container is first emptied and the validity status of the MassCollection is set to false.
If the text is empty, this function returns 0.
If a conversion error is encountered, the faulty text element is appended to error_list_p, the mass container is cleared, m_isValid is set to false and -1 is returned.
If the container of masses is non-empty at the end of the conversion (without error), then m_isValid is set to true and the container size is returned.
Validates this MassCollection and returns true if successful or false otherwise.
Upon validation, error messages are set to error_list_p (not emptied).
If validation is successful, the m_isValid validity status is set to true, to false otherwise.
Assigns other to this MassCollection and returns a reference to this object. If the masses are non-empty, the m_isValid status is set to true, else to false.
This variable holds the comment associated to the MassCollection.
This variable holds the container of mass double values.
This variable holds the name associated to the MassCollection.