All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GfMultiInterval Class Reference

GfMultiInterval represents a subset of the real number line as an ordered set of non-intersecting GfIntervals. More...

Public Types

typedef std::set< GfIntervalSet
 
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. More...
 
void swap (GfMultiInterval &other)
 Swap two multi-intervals. More...
 
Constructors

Constructs an empty multi-interval.

GF_API GfMultiInterval ()
 
GF_API GfMultiInterval (const GfMultiInterval &s)
 Constructs an multi-interval by copying the given set. More...
 
GF_API GfMultiInterval (const GfInterval &i)
 Constructs an multi-interval with the single given interval. More...
 
GF_API GfMultiInterval (const std::vector< GfInterval > &intervals)
 Constructs an multi-interval containing the given input intervals. More...
 
Accessors
GF_API bool IsEmpty () const
 Returns true if the multi-interval is empty. More...
 
GF_API size_t GetSize () const
 Returns the number of intervals in the set. More...
 
GF_API GfInterval GetBounds () const
 Returns an interval bounding the entire multi-interval. More...
 
GF_API bool Contains (double d) const
 Returns true if the multi-interval contains the given value. More...
 
GF_API bool Contains (const GfInterval &i) const
 Returns true if the multi-interval contains the given interval. More...
 
GF_API bool Contains (const GfMultiInterval &s) const
 Returns true if the multi-interval contains all the intervals in the given multi-interval. More...
 
Mutation
GF_API void Clear ()
 Clear the multi-interval. More...
 
GF_API void Add (const GfInterval &i)
 Add the given interval to the multi-interval. More...
 
GF_API void Add (const GfMultiInterval &s)
 Add the given multi-interval to the multi-interval. More...
 
GF_API void ArithmeticAdd (const GfInterval &i)
 Uses the given interval to extend the multi-interval in the interval arithmetic sense. More...
 
GF_API void Remove (const GfInterval &i)
 Remove the given interval from this multi-interval. More...
 
GF_API void Remove (const GfMultiInterval &s)
 Remove the given multi-interval from this multi-interval. More...
 
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. More...
 
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. More...
 
GF_API const_iterator upper_bound (double x) const
 Returns an iterator identifying the first (lowest) interval whose minimum value is > x. More...
 
GF_API const_iterator GetNextNonContainingInterval (double x) const
 Returns an iterator identifying the first (loest) interval whose minimum value is > x. More...
 
GF_API const_iterator GetPriorNonContainingInterval (double x) const
 Returns an iterator identifying the last (highest) interval whose maximum value is < x. More...
 
GF_API const_iterator GetContainingInterval (double x) const
 Returns an iterator identifying the interval that contains x. More...
 

Static Public Member Functions

static GfMultiInterval GetFullInterval ()
 Returns the full interval (-inf, inf). More...
 

Friends

size_t hash_value (const GfMultiInterval &mi)
 

Detailed Description

GfMultiInterval represents a subset of the real number line as an ordered set of non-intersecting GfIntervals.

Definition at line 46 of file multiInterval.h.

Constructor & Destructor Documentation

GF_API GfMultiInterval ( const GfMultiInterval s)
inline

Constructs an multi-interval by copying the given set.

Definition at line 58 of file multiInterval.h.

GF_API GfMultiInterval ( const GfInterval i)
explicit

Constructs an multi-interval with the single given interval.

GF_API GfMultiInterval ( const std::vector< GfInterval > &  intervals)
explicit

Constructs an multi-interval containing the given input intervals.

Member Function Documentation

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.

GF_API void Clear ( )
inline

Clear the multi-interval.

Definition at line 110 of file multiInterval.h.

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.

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()

static GfMultiInterval GetFullInterval ( )
inlinestatic

Returns the full interval (-inf, inf).

Definition at line 166 of file multiInterval.h.

GF_API const_iterator GetNextNonContainingInterval ( double  x) const

Returns an iterator identifying the first (loest) 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().

GF_API size_t GetSize ( ) const
inline

Returns the number of intervals in the set.

Definition at line 88 of file multiInterval.h.

GF_API size_t Hash ( ) const

Hash value.

Just a basic hash function, not particularly high quality.

GF_API bool IsEmpty ( ) const
inline

Returns true if the multi-interval is empty.

Definition at line 85 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().

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.

void swap ( GfMultiInterval other)
inline

Swap two multi-intervals.

Definition at line 171 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().


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