#include <rangeset.h>
Public Member Functions | |
void | clear () |
void | reserve (tsize n) |
tsize | size () const |
const rtype & | data () const |
const T & | ivbegin (tdiff i) const |
const T & | ivend (tdiff i) const |
T | ivlen (tdiff i) const |
void | append (const T &v1, const T &v2) |
void | append (const T &v) |
void | append (const rangeset &other) |
void | add (const T &v1, const T &v2) |
void | add (const T &v) |
void | remove (const T &v1, const T &v2) |
void | remove (const T &v) |
void | intersect (const T &a, const T &b) |
T | nval () const |
void | toVector (std::vector< T > &res) const |
void | unite (const rangeset &other) |
void | intersect (const rangeset &other) |
void | subtract (const rangeset &other) |
void | setToUnion (const rangeset &a, const rangeset &b) |
void | setToIntersection (const rangeset &a, const rangeset &b) |
void | setToDifference (const rangeset &a, const rangeset &b) |
tdiff | findInterval (const T &v) const |
bool | equals (const rangeset &other) const |
bool | containsAll (T a, T b) const |
bool | contains (T v) const |
bool | contains (const rangeset &other) const |
Definition at line 43 of file rangeset.h.
void rangeset< T >::clear | ( | ) | [inline] |
Removes all rangeset entries.
Definition at line 104 of file rangeset.h.
Reserves space for n ranges.
Definition at line 106 of file rangeset.h.
Returns the current number of ranges.
Definition at line 108 of file rangeset.h.
const rtype& rangeset< T >::data | ( | ) | const [inline] |
Returns the current vector of ranges.
Definition at line 110 of file rangeset.h.
Returns the first value of range i.
Definition at line 113 of file rangeset.h.
Returns the one-past-last value of range i.
Definition at line 115 of file rangeset.h.
Returns the length of range i.
Definition at line 117 of file rangeset.h.
void rangeset< T >::append | ( | const T & | v1, | |
const T & | v2 | |||
) | [inline] |
Appends [v1;v2[ to the rangeset. v1 must be larger than the minimum of the last range in the rangeset.
Definition at line 121 of file rangeset.h.
void rangeset< T >::append | ( | const T & | v | ) | [inline] |
Appends [v;v+1[ to the rangeset. v must be larger than the minimum of the last range in the rangeset.
Definition at line 134 of file rangeset.h.
Appends other to the rangeset. All values in other must be larger than the minimum of the last range in the rangeset.
Definition at line 139 of file rangeset.h.
void rangeset< T >::add | ( | const T & | v1, | |
const T & | v2 | |||
) | [inline] |
After this operation, the rangeset contains the union of itself with [v1;v2[.
Definition at line 147 of file rangeset.h.
void rangeset< T >::add | ( | const T & | v | ) | [inline] |
After this operation, the rangeset contains the union of itself with [v;v+1[.
Definition at line 150 of file rangeset.h.
void rangeset< T >::remove | ( | const T & | v1, | |
const T & | v2 | |||
) | [inline] |
Removes all values within [v1;v2[ from the rangeset.
Definition at line 153 of file rangeset.h.
void rangeset< T >::remove | ( | const T & | v | ) | [inline] |
Removes the value v from the rangeset.
Definition at line 155 of file rangeset.h.
void rangeset< T >::intersect | ( | const T & | a, | |
const T & | b | |||
) | [inline] |
Removes all values not within [v1;v2[ from the rangeset.
Definition at line 158 of file rangeset.h.
T rangeset< T >::nval | ( | ) | const [inline] |
Returns the total number of elements in the rangeset.
Definition at line 177 of file rangeset.h.
void rangeset< T >::toVector | ( | std::vector< T > & | res | ) | const [inline] |
After this opration, res contains all elements of the rangeset in ascending order.
Definition at line 187 of file rangeset.h.
After this operation, the rangeset contains the union of itself and other.
Definition at line 198 of file rangeset.h.
After this operation, the rangeset contains the intersection of itself and other.
Definition at line 206 of file rangeset.h.
After this operation, the rangeset contains the union of itself with the inverse of other.
Definition at line 214 of file rangeset.h.
void rangeset< T >::setToUnion | ( | const rangeset< T > & | a, | |
const rangeset< T > & | b | |||
) | [inline] |
After this operation, the rangeset contains the union of a and b.
Definition at line 222 of file rangeset.h.
void rangeset< T >::setToIntersection | ( | const rangeset< T > & | a, | |
const rangeset< T > & | b | |||
) | [inline] |
After this operation, the rangeset contains the intersection of a and b.
Definition at line 226 of file rangeset.h.
void rangeset< T >::setToDifference | ( | const rangeset< T > & | a, | |
const rangeset< T > & | b | |||
) | [inline] |
After this operation, the rangeset contains the union of a with the inverse of b.
Definition at line 230 of file rangeset.h.
Returns the index of the interval containing v; if no such interval exists, -1 is returned.
Definition at line 235 of file rangeset.h.
Returns true if the rangeset is identical to other, else false.
Definition at line 243 of file rangeset.h.
bool rangeset< T >::containsAll | ( | T | a, | |
T | b | |||
) | const [inline] |
Returns true if the rangeset contains all values in the range [a;b[, else false.
Definition at line 248 of file rangeset.h.
bool rangeset< T >::contains | ( | T | v | ) | const [inline] |
Returns true if the rangeset contains the value v, else false.
Definition at line 256 of file rangeset.h.
Returns true if the rangeset contains all values stored in other, else false.
Definition at line 260 of file rangeset.h.