| <large>libXpertMassCore and libXpertMassGui Developer Documentation</large>

- libXpertMassCore
- OligomerCollection

# MsXpS::libXpertMassCore::OligomerCollection Class

class MsXpS::libXpertMassCore::OligomerCollection

The OligomerCollection class provides abstractions to work with Oligomer instances that have been produced in specific contexts, like Polymer cleavages or Oligomer fragmentations. More...

Header: | `#include <MsXpS/libXpertMassCore/OligomerCollection.hpp>`
Inherits: | QObject

- List of all members, including inherited members
- OligomerCollection is part of Polymer chemistry building blocks.

## Public Functions

| OligomerCollection(const QString &name = QString(), MsXpS::libXpertMassCore::PolymerCstQSPtr polymer_cqsp = nullptr, MsXpS::libXpertMassCore::Enums::MassType mass_type = Enums::MassType::BOTH)
| OligomerCollection(const MsXpS::libXpertMassCore::OligomerCollection &other)
virtual | ~OligomerCollection()
QString | allOligomerMassesToString(MsXpS::libXpertMassCore::Enums::MassType mass_type)
void | clear()
MsXpS::libXpertMassCore::OligomerSPtr | findOligomerEncompassing(MsXpS::libXpertMassCore::MonomerCstSPtr monomer_csp, std::size_t &oligomer_index)
MsXpS::libXpertMassCore::OligomerSPtr | findOligomerEncompassing(MsXpS::libXpertMassCore::MonomerSPtr monomer_sp, std::size_t &oligomer_index)
MsXpS::libXpertMassCore::OligomerSPtr | findOligomerEncompassing(std::size_t monomer_index, std::size_t &oligomer_index)
const QString & | getComment() const
MsXpS::libXpertMassCore::Enums::MassType | getMassType() const
const QString & | getName() const
const std::vector<MsXpS::libXpertMassCore::OligomerSPtr> & | getOligomersCstRef() const
std::vector<MsXpS::libXpertMassCore::OligomerSPtr> & | getOligomersRef()
const MsXpS::libXpertMassCore::PolymerCstQSPtr | getPolymer() const
void | setComment(const QString &comment)
void | setMassType(MsXpS::libXpertMassCore::Enums::MassType mass_type)
void | setName(const QString &name)
void | setPolymer(MsXpS::libXpertMassCore::PolymerCstQSPtr polymer_cqsp)
std::size_t | size() const
void | sortAscending()
QString | toString() const
bool | operator!=(const MsXpS::libXpertMassCore::OligomerCollection &other) const
MsXpS::libXpertMassCore::OligomerCollection & | operator=(const MsXpS::libXpertMassCore::OligomerCollection &other)
bool | operator==(const MsXpS::libXpertMassCore::OligomerCollection &other) const

## Static Public Members

bool | avgMassCompare(const MsXpS::libXpertMassCore::OligomerSPtr o1_sp, const MsXpS::libXpertMassCore::OligomerSPtr o2_sp)
bool | monoMassCompare(const MsXpS::libXpertMassCore::OligomerSPtr o1_sp, const MsXpS::libXpertMassCore::OligomerSPtr o2_sp)

## Protected Variables

QString | m_comment
MsXpS::libXpertMassCore::Enums::MassType | m_massType
QString | m_name
std::vector<MsXpS::libXpertMassCore::OligomerSPtr> | m_oligomers
MsXpS::libXpertMassCore::PolymerCstQSPtr | mcsp_polymer

## Detailed Description

## Member Function Documentation

### OligomerCollection::OligomerCollection(const QString &name = QString(), MsXpS::libXpertMassCore::PolymerCstQSPtr polymer_cqsp = nullptr, MsXpS::libXpertMassCore::Enums::MassType mass_type = Enums::MassType::BOTH)

Constructs an OligomerCollection instance with a number of parameters.

- name The name of the OligomerCollection
- polymer_cqsp The Polymer about which this OligomerCollection is about
- mass_type The type of mass that is dealt with in a number of calculations

### OligomerCollection::OligomerCollection(const MsXpS::libXpertMassCore::OligomerCollection &other)

Constructs an OligomerCollection instance as a copy of other.

The Oligomer instances in the member container are instantiated anew (deep copy).

### `[virtual noexcept]` OligomerCollection::~OligomerCollection()

Destructs the OligomerCollection.

### QString OligomerCollection::allOligomerMassesToString(MsXpS::libXpertMassCore::Enums::MassType mass_type)

Returns a string in which all the Oligomer instances present in the member container are represented as text.

The masses of the Oligomer instances are reported for the mass_type. If mass_type is Enums::MassType::BOTH, the the member mass type is used.

### `[static]` bool OligomerCollection::avgMassCompare(const MsXpS::libXpertMassCore::OligomerSPtr o1_sp, const MsXpS::libXpertMassCore::OligomerSPtr o2_sp)

Returns true if the average mass of o1_sp is smaller than that of o2_sp, else returns false.

### void OligomerCollection::clear()

Clears the member Oligomer container.

### MsXpS::libXpertMassCore::OligomerSPtr OligomerCollection::findOligomerEncompassing(MsXpS::libXpertMassCore::MonomerCstSPtr monomer_csp, std::size_t &oligomer_index)

Returns the Oligomer instance that encompasses Monomer monomer_csp.

This function starts searching for Oligomer instances in the member Oligomer container at oligomer_index.

If oligomer_index is out of bounds, nullptr is returned.

When an Oligomer is found, its index in the member Oligomer container is set to oligomer_index and its pointer is returned.

If no Oligomer is found, returns nullptr;

### MsXpS::libXpertMassCore::OligomerSPtr OligomerCollection::findOligomerEncompassing(MsXpS::libXpertMassCore::MonomerSPtr monomer_sp, std::size_t &oligomer_index)

Returns the Oligomer instance that encompasses Monomer monomer_sp.

This function starts searching for Oligomer instances in the member Oligomer container at oligomer_index.

If oligomer_index is out of bounds, nullptr is returned.

When an Oligomer is found, its index in the member Oligomer container is set to oligomer_index and its pointer is returned.

If no Oligomer is found, returns nullptr;

### MsXpS::libXpertMassCore::OligomerSPtr OligomerCollection::findOligomerEncompassing(std::size_t monomer_index, std::size_t &oligomer_index)

Returns the Oligomer instance that encompasses a Monomer at monomer_index.

This function starts searching for Oligomer instances in the member Oligomer container at oligomer_index.

If oligomer_index is out of bounds, nullptr is returned.

When an Oligomer is found, its index in the member Oligomer container is set to oligomer_index and its pointer is returned.

If no Oligomer is found, returns nullptr;

### const QString &OligomerCollection::getComment() const

Returns the comment.

### MsXpS::libXpertMassCore::Enums::MassType OligomerCollection::getMassType() const

Returns the type of mass to be dealt with by default.

### const QString &OligomerCollection::getName() const

Returns the name.

### const std::vector<MsXpS::libXpertMassCore::OligomerSPtr> &OligomerCollection::getOligomersCstRef() const

Returns a const reference to the Oligomer container.

### std::vector<MsXpS::libXpertMassCore::OligomerSPtr> &OligomerCollection::getOligomersRef()

Returns a reference to the Oligomer container.

### const MsXpS::libXpertMassCore::PolymerCstQSPtr OligomerCollection::getPolymer() const

Returns the polymer.

### `[static]` bool OligomerCollection::monoMassCompare(const MsXpS::libXpertMassCore::OligomerSPtr o1_sp, const MsXpS::libXpertMassCore::OligomerSPtr o2_sp)

Returns true if the monoisotopic mass of o1_sp is smaller than that of o2_sp, else returns false.

### void OligomerCollection::setComment(const QString &comment)

Sets the comment.

### void OligomerCollection::setMassType(MsXpS::libXpertMassCore::Enums::MassType mass_type)

Sets the type of mass mass_type to be dealt with by default.

### void OligomerCollection::setName(const QString &name)

Sets the name.

### void OligomerCollection::setPolymer(MsXpS::libXpertMassCore::PolymerCstQSPtr polymer_cqsp)

Sets the the polymer to polymer_cqsp.

### std::size_t OligomerCollection::size() const

Returns the size of this OligomerCollection as the count of Oligomer instances in the member container.

### void OligomerCollection::sortAscending()

Sorts the Oligomer instances in the member container according to ascending masses of the default member Enums::MassType.

### QString OligomerCollection::toString() const

Returns a text string representing this OligomerCollection's Oligomer instances.

See also Oligomer::toString.

### bool OligomerCollection::operator!=(const MsXpS::libXpertMassCore::OligomerCollection &other) const

Returns true if this OligomerCollection instance and other differ, false otherwise.

Returns the negated value returned from operator==().

### MsXpS::libXpertMassCore::OligomerCollection &OligomerCollection::operator=(const MsXpS::libXpertMassCore::OligomerCollection &other)

Assigns other to this instance.

### bool OligomerCollection::operator==(const MsXpS::libXpertMassCore::OligomerCollection &other) const

Returns true if this OligomerCollection instance and other are identical, false otherwise.

## Member Variable Documentation

### QString OligomerCollection::m_comment

This variable holds a comment associated to the OligomerCollection.

### MsXpS::libXpertMassCore::Enums::MassType OligomerCollection::m_massType

This variable holds the type of mass that is dealt with in a number of calculations.

### QString OligomerCollection::m_name

This variable holds the name of the OligomerCollection.

### std::vector<MsXpS::libXpertMassCore::OligomerSPtr> OligomerCollection::m_oligomers

This variable holds the container of Oligomer instances in this OligomerCollection.

### MsXpS::libXpertMassCore::PolymerCstQSPtr OligomerCollection::mcsp_polymer

This variable holds the Polymer instance about which this OligomerCollection is about.