|
GfMultiInterval represents a subset of the real number line as an ordered set of non-intersecting GfIntervals. More...
#include <multiInterval.h>
Public Types | |
typedef std::set< GfInterval > | Set |
typedef Set::const_iterator | const_iterator |
typedef Set::const_iterator | iterator |
Public Member Functions | |
GF_API bool | operator== (const GfMultiInterval &that) const |
GF_API bool | operator!= (const GfMultiInterval &that) const |
GF_API bool | operator< (const GfMultiInterval &that) const |
GF_API bool | operator>= (const GfMultiInterval &that) const |
GF_API bool | operator> (const GfMultiInterval &that) const |
GF_API bool | operator<= (const GfMultiInterval &that) const |
GF_API size_t | Hash () const |
Hash value. | |
void | swap (GfMultiInterval &other) |
Swap two multi-intervals. | |
Constructors | |
Constructs an empty multi-interval. | |
GfMultiInterval ()=default | |
GF_API | GfMultiInterval (const GfInterval &i) |
Constructs an multi-interval with the single given interval. | |
GF_API | GfMultiInterval (const std::vector< GfInterval > &intervals) |
Constructs an multi-interval containing the given input intervals. | |
Accessors | |
GF_API bool | IsEmpty () const |
Returns true if the multi-interval is empty. | |
GF_API size_t | GetSize () const |
Returns the number of intervals in the set. | |
GF_API GfInterval | GetBounds () const |
Returns an interval bounding the entire multi-interval. | |
GF_API bool | Contains (double d) const |
Returns true if the multi-interval contains the given value. | |
GF_API bool | Contains (const GfInterval &i) const |
Returns true if the multi-interval contains the given interval. | |
GF_API bool | Contains (const GfMultiInterval &s) const |
Returns true if the multi-interval contains all the intervals in the given multi-interval. | |
Mutation | |
GF_API void | Clear () |
Clear the multi-interval. | |
GF_API void | Add (const GfInterval &i) |
Add the given interval to the multi-interval. | |
GF_API void | Add (const GfMultiInterval &s) |
Add the given multi-interval to the multi-interval. | |
GF_API void | ArithmeticAdd (const GfInterval &i) |
Uses the given interval to extend the multi-interval in the interval arithmetic sense. | |
GF_API void | Remove (const GfInterval &i) |
Remove the given interval from this multi-interval. | |
GF_API void | Remove (const GfMultiInterval &s) |
Remove the given multi-interval from this multi-interval. | |
GF_API void | Intersect (const GfInterval &i) |
GF_API void | Intersect (const GfMultiInterval &s) |
GF_API GfMultiInterval | GetComplement () const |
Return the complement of this set. | |
Iteration | |
Only const iterators are returned. To maintain the invariants of the multi-interval, changes must be made via the public mutation API. | |
GF_API const_iterator | begin () const |
GF_API const_iterator | end () const |
GF_API const_iterator | lower_bound (double x) const |
Returns an iterator identifying the first (lowest) interval whose minimum value is >= x. | |
GF_API const_iterator | upper_bound (double x) const |
Returns an iterator identifying the first (lowest) interval whose minimum value is > x. | |
GF_API const_iterator | GetNextNonContainingInterval (double x) const |
Returns an iterator identifying the first (lowest) interval whose minimum value is > x. | |
GF_API const_iterator | GetPriorNonContainingInterval (double x) const |
Returns an iterator identifying the last (highest) interval whose maximum value is < x. | |
GF_API const_iterator | GetContainingInterval (double x) const |
Returns an iterator identifying the interval that contains x. | |
Static Public Member Functions | |
static GfMultiInterval | GetFullInterval () |
Returns the full interval (-inf, inf). | |
Friends | |
size_t | hash_value (const GfMultiInterval &mi) |
GfMultiInterval represents a subset of the real number line as an ordered set of non-intersecting GfIntervals.
Definition at line 29 of file multiInterval.h.
typedef Set::const_iterator const_iterator |
Definition at line 33 of file multiInterval.h.
typedef Set::const_iterator iterator |
Definition at line 34 of file multiInterval.h.
typedef std::set<GfInterval> Set |
Definition at line 32 of file multiInterval.h.
|
explicit |
Constructs an multi-interval with the single given interval.
|
explicit |
Constructs an multi-interval containing the given input intervals.
GF_API void Add | ( | const GfInterval & | i | ) |
Add the given interval to the multi-interval.
GF_API void Add | ( | const GfMultiInterval & | s | ) |
Add the given multi-interval to the multi-interval.
Sets this object to the union of the two sets.
GF_API void ArithmeticAdd | ( | const GfInterval & | i | ) |
Uses the given interval to extend the multi-interval in the interval arithmetic sense.
|
inline |
Definition at line 121 of file multiInterval.h.
|
inline |
Clear the multi-interval.
Definition at line 91 of file multiInterval.h.
GF_API bool Contains | ( | const GfInterval & | i | ) | const |
Returns true if the multi-interval contains the given interval.
GF_API bool Contains | ( | const GfMultiInterval & | s | ) | const |
Returns true if the multi-interval contains all the intervals in the given multi-interval.
GF_API bool Contains | ( | double | d | ) | const |
Returns true if the multi-interval contains the given value.
|
inline |
Definition at line 122 of file multiInterval.h.
GF_API GfInterval GetBounds | ( | ) | const |
Returns an interval bounding the entire multi-interval.
Returns an empty interval if the multi-interval is empty.
GF_API GfMultiInterval GetComplement | ( | ) | const |
Return the complement of this set.
GF_API const_iterator GetContainingInterval | ( | double | x | ) | const |
Returns an iterator identifying the interval that contains x.
If no interval contains x, then it returns end()
|
inlinestatic |
Returns the full interval (-inf, inf).
Definition at line 147 of file multiInterval.h.
GF_API const_iterator GetNextNonContainingInterval | ( | double | x | ) | const |
Returns an iterator identifying the first (lowest) interval whose minimum value is > x.
If no such interval exists, returns end().
GF_API const_iterator GetPriorNonContainingInterval | ( | double | x | ) | const |
Returns an iterator identifying the last (highest) interval whose maximum value is < x.
If no such interval exists, returns end().
|
inline |
Returns the number of intervals in the set.
Definition at line 69 of file multiInterval.h.
GF_API size_t Hash | ( | ) | const |
Hash value.
Just a basic hash function, not particularly high quality.
|
inline |
Returns true if the multi-interval is empty.
Definition at line 66 of file multiInterval.h.
GF_API const_iterator lower_bound | ( | double | x | ) | const |
Returns an iterator identifying the first (lowest) interval whose minimum value is >= x.
If no such interval exists, returns end().
|
inline |
Definition at line 47 of file multiInterval.h.
|
inline |
Definition at line 48 of file multiInterval.h.
|
inline |
Definition at line 51 of file multiInterval.h.
|
inline |
Definition at line 46 of file multiInterval.h.
|
inline |
Definition at line 50 of file multiInterval.h.
|
inline |
Definition at line 49 of file multiInterval.h.
GF_API void Remove | ( | const GfInterval & | i | ) |
Remove the given interval from this multi-interval.
GF_API void Remove | ( | const GfMultiInterval & | s | ) |
Remove the given multi-interval from this multi-interval.
|
inline |
Swap two multi-intervals.
Definition at line 152 of file multiInterval.h.
GF_API const_iterator upper_bound | ( | double | x | ) | const |
Returns an iterator identifying the first (lowest) interval whose minimum value is > x.
If no such interval exists, returns end().
|
friend |
Definition at line 58 of file multiInterval.h.