Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
MantidQt::MantidWidgets::IntervalList Class Reference

#include <MantidWSIndexDialog.h>

Public Member Functions

void addInterval (int single)
 Add an interval starting and ending at single. More...
 
void addInterval (int start, int end)
 Add an interval starting at start and ending at end. More...
 
void addInterval (Interval)
 Add an interval. More...
 
void addIntervalList (const IntervalList &)
 Adds an IntervalList to this IntervalList. More...
 
void addIntervals (QString)
 Attempts to parse the given string into a IntervalList to add. More...
 
void clear ()
 Clears the interval list. More...
 
bool contains (const Interval &) const
 Returns true if this interval list completely contains the interval passed to it, else false. More...
 
bool contains (const IntervalList &) const
 Returns true if this interval list completely contains the interval list passed to it, else false. More...
 
std::set< int > getIntSet () const
 Returns a set of ints that represents the interval. More...
 
const QList< Interval > & getList () const
 Returns a reference to the list of Intervals. More...
 
 IntervalList (const Interval &)
 Constructor - with a list containing a single Interval. More...
 
 IntervalList (const QString &)
 Constructor - with a list created by parsing the input string. More...
 
 IntervalList (void)
 Constructor - with empty list. More...
 
void setIntervalList (const IntervalList &)
 Replaces the current list with the list belonging to given IntervalList object. More...
 
QString toQString (int numOfIntervals=6) const
 Convenience function that returns the contents of toStdString as a QString object. More...
 
std::string toStdString (int numOfIntervals=6) const
 Returns a string that represents the IntervalList, of the form "0, 2-5, 8, 10-12". More...
 
int totalIntervalLength () const
 Returns the combined length of all Intervals in the list. More...
 

Static Public Member Functions

static IntervalList intersect (const IntervalList &, const Interval &)
 Returns an IntervalList which is the intersection of the given IntervalList and Interval. More...
 
static IntervalList intersect (const IntervalList &, const IntervalList &)
 Returns an IntervalList which is the intersection of the given IntervalLists. More...
 
static bool isParsable (const QString &)
 Returns true if the QString can be parsed into an IntervalList, else false. More...
 
static bool isParsable (const QString &, const IntervalList &)
 Returns true if the QString can be parsed into an IntervalList which can then be contained in the IntervalList given, else false. More...
 

Private Attributes

QList< Intervalm_list
 A list of all the Intervals in this IntervalList. More...
 

Detailed Description

Definition at line 112 of file MantidWSIndexDialog.h.

Constructor & Destructor Documentation

◆ IntervalList() [1/3]

MantidQt::MantidWidgets::IntervalList::IntervalList ( void  )
default

Constructor - with empty list.

◆ IntervalList() [2/3]

MantidQt::MantidWidgets::IntervalList::IntervalList ( const QString &  intervals)
explicit

Constructor - with a list created by parsing the input string.

Definition at line 1007 of file MantidWSIndexDialog.cpp.

References addIntervals().

◆ IntervalList() [3/3]

MantidQt::MantidWidgets::IntervalList::IntervalList ( const Interval interval)
explicit

Constructor - with a list containing a single Interval.

Definition at line 1009 of file MantidWSIndexDialog.cpp.

References m_list.

Member Function Documentation

◆ addInterval() [1/3]

void MantidQt::MantidWidgets::IntervalList::addInterval ( int  single)

◆ addInterval() [2/3]

void MantidQt::MantidWidgets::IntervalList::addInterval ( int  start,
int  end 
)

Add an interval starting at start and ending at end.

Definition at line 1118 of file MantidWSIndexDialog.cpp.

References addInterval().

◆ addInterval() [3/3]

void MantidQt::MantidWidgets::IntervalList::addInterval ( Interval  interval)

◆ addIntervalList()

void MantidQt::MantidWidgets::IntervalList::addIntervalList ( const IntervalList intervals)

Adds an IntervalList to this IntervalList.

Definition at line 1137 of file MantidWSIndexDialog.cpp.

References addInterval(), and getList().

◆ addIntervals()

void MantidQt::MantidWidgets::IntervalList::addIntervals ( QString  intervals)

Attempts to parse the given string into a IntervalList to add.

Definition at line 1124 of file MantidWSIndexDialog.cpp.

References addInterval().

Referenced by IntervalList(), and MantidQt::MantidWidgets::MantidWSIndexWidget::plotRequested().

◆ clear()

void MantidQt::MantidWidgets::IntervalList::clear ( )

Clears the interval list.

Definition at line 1149 of file MantidWSIndexDialog.cpp.

References m_list.

Referenced by MantidQt::MantidWidgets::MantidWSIndexWidget::validatePlotOptions().

◆ contains() [1/2]

bool MantidQt::MantidWidgets::IntervalList::contains ( const Interval other) const

Returns true if this interval list completely contains the interval passed to it, else false.

Definition at line 1162 of file MantidWSIndexDialog.cpp.

References m_list.

Referenced by isParsable().

◆ contains() [2/2]

bool MantidQt::MantidWidgets::IntervalList::contains ( const IntervalList other) const

Returns true if this interval list completely contains the interval list passed to it, else false.

Definition at line 1168 of file MantidWSIndexDialog.cpp.

◆ getIntSet()

std::set< int > MantidQt::MantidWidgets::IntervalList::getIntSet ( ) const

Returns a set of ints that represents the interval.

Definition at line 1151 of file MantidWSIndexDialog.cpp.

References m_list.

Referenced by MantidQt::MantidWidgets::MantidWSIndexWidget::getPlots(), and intersect().

◆ getList()

const QList< Interval > & MantidQt::MantidWidgets::IntervalList::getList ( ) const

◆ intersect() [1/2]

IntervalList MantidQt::MantidWidgets::IntervalList::intersect ( const IntervalList aList,
const Interval bInterval 
)
static

◆ intersect() [2/2]

IntervalList MantidQt::MantidWidgets::IntervalList::intersect ( const IntervalList a,
const IntervalList b 
)
static

Returns an IntervalList which is the intersection of the given IntervalLists.

Definition at line 1198 of file MantidWSIndexDialog.cpp.

References addInterval(), and getIntSet().

◆ isParsable() [1/2]

bool MantidQt::MantidWidgets::IntervalList::isParsable ( const QString &  input)
static

Returns true if the QString can be parsed into an IntervalList, else false.

Definition at line 1183 of file MantidWSIndexDialog.cpp.

Referenced by MantidQt::MantidWidgets::IntervalListValidator::validate().

◆ isParsable() [2/2]

bool MantidQt::MantidWidgets::IntervalList::isParsable ( const QString &  input,
const IntervalList container 
)
static

Returns true if the QString can be parsed into an IntervalList which can then be contained in the IntervalList given, else false.

Definition at line 1174 of file MantidWSIndexDialog.cpp.

References contains().

◆ setIntervalList()

void MantidQt::MantidWidgets::IntervalList::setIntervalList ( const IntervalList intervals)

Replaces the current list with the list belonging to given IntervalList object.

Definition at line 1147 of file MantidWSIndexDialog.cpp.

References getList(), and m_list.

Referenced by MantidQt::MantidWidgets::MantidWSIndexWidget::generateSpectraNumIntervals(), and MantidQt::MantidWidgets::MantidWSIndexWidget::generateWsIndexIntervals().

◆ toQString()

QString MantidQt::MantidWidgets::IntervalList::toQString ( int  numOfIntervals = 6) const

Convenience function that returns the contents of toStdString as a QString object.

Definition at line 1048 of file MantidWSIndexDialog.cpp.

References toStdString().

Referenced by MantidQt::MantidWidgets::MantidWSIndexWidget::initSpectraBox(), and MantidQt::MantidWidgets::MantidWSIndexWidget::initWorkspaceBox().

◆ toStdString()

std::string MantidQt::MantidWidgets::IntervalList::toStdString ( int  numOfIntervals = 6) const

Returns a string that represents the IntervalList, of the form "0, 2-5, 8, 10-12".

String is cut short by default to 6 intervals.

Definition at line 1019 of file MantidWSIndexDialog.cpp.

References m_list.

Referenced by toQString().

◆ totalIntervalLength()

int MantidQt::MantidWidgets::IntervalList::totalIntervalLength ( ) const

Returns the combined length of all Intervals in the list.

Definition at line 1013 of file MantidWSIndexDialog.cpp.

References m_list.

Referenced by MantidQt::MantidWidgets::MantidWSIndexWidget::validatePlotOptions().

Member Data Documentation

◆ m_list

QList<Interval> MantidQt::MantidWidgets::IntervalList::m_list
private

A list of all the Intervals in this IntervalList.

Definition at line 181 of file MantidWSIndexDialog.h.

Referenced by addInterval(), clear(), contains(), getIntSet(), getList(), IntervalList(), setIntervalList(), toStdString(), and totalIntervalLength().


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