ProteoWizard
|
a virtual container of integers, accessible via an iterator interface, stored as union of intervals More...
#include <IntegerSet.hpp>
Classes | |
struct | Interval |
a single closed interval of integers More... | |
class | Iterator |
forward iterator providing readonly access to the virtual container More... |
Public Types | |
typedef std::list< Interval > | Intervals |
collection of Interval objects |
Public Member Functions | |
IntegerSet () | |
default construction | |
IntegerSet (int a) | |
construction with a single integer | |
IntegerSet (int a, int b) | |
construction with a single interval | |
bool | empty () const |
true iff IntegerSet is empty | |
bool | contains (int n) const |
true iff n is in the IntegerSet | |
bool | hasUpperBound (int n) const |
true iff n is an upper bound for the IntegerSet | |
size_t | intervalCount () const |
returns the number of intervals in the set | |
size_t | size () const |
returns the number of integers in the set | |
write access to the virtual container | |
void | insert (Interval interval) |
insert an interval of integers into the virtual container | |
void | insert (int a) |
insert a single integer into the virtual container | |
void | insert (int a, int b) |
insert an interval of integers into the virtual container | |
void | parse (const std::string &intervalList) |
insert intervals by parsing a string representing a whitespace-delimited list of closed intervals: parse(" [-3,2] 5 8-9 10- "); // insert(-3,2); insert(5); insert(8,9); insert(10,INT_MAX); |
Private Attributes | |
Intervals | intervals_ |
Friends | |
PWIZ_API_DECL std::ostream & | operator<< (std::ostream &os, const IntegerSet &integerSet) |
const iterator interface to the virtual container | |
typedef Iterator | const_iterator |
const_iterator | begin () const |
const_iterator | end () const |
a virtual container of integers, accessible via an iterator interface, stored as union of intervals
Definition at line 37 of file IntegerSet.hpp.
typedef std::list<Interval> pwiz::util::IntegerSet::Intervals |
collection of Interval objects
Definition at line 57 of file IntegerSet.hpp.
Definition at line 126 of file IntegerSet.hpp.
pwiz::util::IntegerSet::IntegerSet | ( | ) |
default construction
|
explicit |
construction with a single integer
pwiz::util::IntegerSet::IntegerSet | ( | int | a, |
int | b | ||
) |
construction with a single interval
void pwiz::util::IntegerSet::insert | ( | Interval | interval | ) |
insert an interval of integers into the virtual container
Referenced by test(), testContains(), testIndexSet(), testIntegerSet(), testMSLevelSet(), testScanEventSet(), and testScanNumberSet().
void pwiz::util::IntegerSet::insert | ( | int | a | ) |
insert a single integer into the virtual container
void pwiz::util::IntegerSet::insert | ( | int | a, |
int | b | ||
) |
insert an interval of integers into the virtual container
void pwiz::util::IntegerSet::parse | ( | const std::string & | intervalList | ) |
insert intervals by parsing a string representing a whitespace-delimited list of closed intervals: parse(" [-3,2] 5 8-9 10- "); // insert(-3,2); insert(5); insert(8,9); insert(10,INT_MAX);
Referenced by testParse(), and testParse2().
const_iterator pwiz::util::IntegerSet::begin | ( | ) | const |
Referenced by test(), testInstantiation(), testParse(), and testParse2().
const_iterator pwiz::util::IntegerSet::end | ( | ) | const |
Referenced by test(), testInstantiation(), and testParse().
|
inline |
true iff IntegerSet is empty
Definition at line 132 of file IntegerSet.hpp.
Referenced by test().
bool pwiz::util::IntegerSet::contains | ( | int | n | ) | const |
true iff n is in the IntegerSet
Referenced by testContains().
bool pwiz::util::IntegerSet::hasUpperBound | ( | int | n | ) | const |
true iff n is an upper bound for the IntegerSet
Referenced by testUpperBound().
size_t pwiz::util::IntegerSet::intervalCount | ( | ) | const |
returns the number of intervals in the set
Referenced by testParse(), and testParse2().
size_t pwiz::util::IntegerSet::size | ( | ) | const |
returns the number of integers in the set
Referenced by testParse(), and testParse2().
|
friend |
|
private |
Definition at line 148 of file IntegerSet.hpp.