libXpertMassCore and libXpertMassGui Developer Documentation
  • libXpertMassCore
  • IndexRange
  • MsXpS::libXpertMassCore::IndexRange Class

    class MsXpS::libXpertMassCore::IndexRange

    The IndexRange class provides a range of indices that delimit a region of interest in a Polymer's Sequence instance. More...

    Header: #include <MsXpS/libXpertMassCore/IndexRange.hpp>
    Inherits: QObject

    Public Functions

    IndexRange(QObject *parent = nullptr)
    IndexRange(qsizetype index_start, qsizetype index_stop, QObject *parent = nullptr)
    IndexRange(const MsXpS::libXpertMassCore::IndexRange &other, QObject *parent = nullptr)
    virtual ~IndexRange()
    MsXpS::libXpertMassCore::IndexRange *clone(QObject *parent = nullptr)
    QString indicesAsText() const
    void initialize(const MsXpS::libXpertMassCore::IndexRange &other)
    bool isValid() const
    QString positionsAsText() const
    void reset()
    void sortAscending()
    void sortDescending()
    bool operator!=(const MsXpS::libXpertMassCore::IndexRange &other) const
    bool operator==(const MsXpS::libXpertMassCore::IndexRange &other) const

    Public Variables

    qsizetype m_start
    qsizetype m_stop

    Static Public Members

    MsXpS::libXpertMassCore::IndexRange *clone(const MsXpS::libXpertMassCore::IndexRange &other, QObject *parent = nullptr)

    Detailed Description

    One major IndexRange use case is when defining for what sequence region of a Polymer the masses or the elemental composition is to be computed. Another use case is when performing Sequence cleavages or Oligomer fragmentations: the IndexRange enables the delimitation of the sequence of interest inside a given Polymer's Sequence instance.

    When instantiating a new IndexRange, the start and stop values are automatically sorted in ascending order (start <= stop).

    See also IndexRangeCollection, sortAscending(), and sortDescending().

    Member Function Documentation

    [explicit] IndexRange::IndexRange(QObject *parent = nullptr)

    Constructs an IndexRange instance using parent as the parent object of this new instance.

    Upon construction, the member data m_start and m_stop are initialized with std::numeric_limits<std::size_t>::max() values as a means to check if the IndexRange was initialized by the user or not.

    [explicit] IndexRange::IndexRange(qsizetype index_start, qsizetype index_stop, QObject *parent = nullptr)

    brief Constructs an IndexRange instance initializing the* start and stop members to the index_start and index_stop values, respectively.

    The values are sorted in ascending order upon construction.

    [explicit] IndexRange::IndexRange(const MsXpS::libXpertMassCore::IndexRange &other, QObject *parent = nullptr)

    Constructs an IndexRange instance using other as a template and parent as the parent of this new instance.

    The values are sorted in ascending order upon construction.

    See also sortAscending() and sortDescending().

    [virtual noexcept] IndexRange::~IndexRange()

    brief Destructs this IndexRange instance.

    MsXpS::libXpertMassCore::IndexRange *IndexRange::clone(QObject *parent = nullptr)

    Allocates an returns a new IndexRange instance, initializing it using this instance's member values and setting its parent to parent.

    The values are sorted in ascending order in the clone.

    See also sortAscending() and sortDescending().

    [static] MsXpS::libXpertMassCore::IndexRange *IndexRange::clone(const MsXpS::libXpertMassCore::IndexRange &other, QObject *parent = nullptr)

    br*ief Allocates an returns a new IndexRange instance, initializing it using other and setting its parent to parent.

    The values are sorted in ascending order in the clone.

    See also sortAscending() and sortDescending().

    QString IndexRange::indicesAsText() const

    Returns a string representing this IndexRange instance in the form "[start-stop]".

    The start and stop values are indices (not positions).

    See also positionsAsText().

    void IndexRange::initialize(const MsXpS::libXpertMassCore::IndexRange &other)

    Initializes this instance using other. The parent of this instance is unchanged.

    The values are sorted in ascending order upon initialization.

    See also sortAscending() and sortDescending().

    bool IndexRange::isValid() const

    Returns true if this instance is valid.

    The IndexRange intance is considered valid if m_start and m_stop contain valid values, that is, not the default-assigned values.

    QString IndexRange::positionsAsText() const

    Returns a string representing this IndexRange instance in the form "[start-stop]".

    Note: The start and stop values are positions (not indices). This means that the returned values correspond to m_start and m_stop both incremented by one unit.

    See also indicesAsText().

    void IndexRange::reset()

    Resets the member data to default values.

    void IndexRange::sortAscending()

    Makes sure that m_start is <= to m_stop.

    void IndexRange::sortDescending()

    Makes sure that m_start is >= to m_stop.

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

    Returns true if this and other IndexRange instances are different.

    The parent is not checked.

    Return the negation of operator==().

    bool IndexRange::operator==(const MsXpS::libXpertMassCore::IndexRange &other) const

    Returns true if this and other IndexRange instances are identical.

    The parent is not checked.

    Member Variable Documentation

    qsizetype IndexRange::m_start

    Index that marks the start of the index range.

    qsizetype IndexRange::m_stop

    Index that marks the stop of the index range.