![]() |
User Manual, Developers Guide and API Documentation |
![]() |
#include <Interval.hpp>


Public Types | |
| typedef T | ValueType |
Public Member Functions | |
| bool | contains (const Interval &x) const |
| Check if the interval x is totally contained in *this. | |
| bool | contains (const ValueType &x) const |
| Check if value x is in the interval. | |
| Interval | intersect (const Interval &x) const |
| Create a new interval by intersecting *this with x. | |
| Interval () | |
| Return empty interval. | |
| bool | isAbove (const Interval &x) const |
| Check if this interval is above interval x. | |
| bool | isAbove (const ValueType &x) const |
| Check if the value x is smaller than all values of the interval. | |
| bool | isBelow (const Interval &x) const |
| Check if this interval is below interval x. | |
| bool | isBelow (const ValueType &x) const |
| Check if the value x is greater than all values of the interval. | |
| bool | isEmpty () const |
| Check if this interval is empty. | |
| Interval | join (const Interval &x) const |
| Create a new interval by joining *this with x. | |
| bool | joinableWith (const Interval &x) const |
| Check if this interval can be joined with interval x. | |
| ValueType | max () const |
| Return maximal value that is contained in this interval. | |
| ValueType | min () const |
| Return minimal value that is contained in this interval. | |
| bool | operator!= (const Interval &x) const |
| bool | operator== (const Interval &x) const |
| Check if two intervals are equal. | |
| bool | overlaps (const Interval &x) const |
| Check if this interval overlaps with the interval x. | |
Static Public Member Functions | |
| static BetweenEndpoint | Between (const ValueType &a) |
| Create open interval. | |
| static Interval | CreateFrom (const pyconfig::View &config) |
| Create interval from pyconfig::View. | |
| static Interval | EmptyInterval () |
| Return empty interval. | |
| static FromEndpoint | From (const ValueType &a) |
| Create closed interval. | |
| static FromInclExclEndpoint | FromExcluding (const ValueType &a) |
| Create half-open (or open) interval. | |
| static FromInclExclEndpoint | FromIncluding (const ValueType &a) |
| Create half-open (or closed) interval. | |
Private Member Functions | |
| Interval (const Endpoint &a, const Endpoint &b) | |
Private Attributes | |
| Endpoint | a |
| Endpoint | b |
Friends | |
| class | Endpoint |
Classes | |
| class | BetweenEndpoint |
| Endpoint for syntax Between ... And. More... | |
| class | Endpoint |
| Open or closed endpoint of an interval. More... | |
| class | FromEndpoint |
| Endpoint for syntax From ... To. More... | |
| class | FromInclExclEndpoint |
| Endpoint for syntax FromIncluding/FromExcluding ... ToIncluding/ToExcluding. More... | |
| T | Interval of this type. |
T. Please be aware that in mathematics intervals are usually subsets of R, but computers - being finite - don't have reals. So you can create Intervals of integer and floating point types with this class.Intervals are created quite easily. Examples:
typedef Interval<double> FrequencyRange; FrequencyRange frequencies = FrequencyRange::From(150).To(2000);
typedef Interval<double> DistanceRange; DistanceRange distances = DistanceRange::Between(0).And(INFINITY);
typedef Interval<double> TimeRange;
TimeRange allowedDelay = TimeRange::FromIncluding(0).ToExcluding(200);
Note that the constructor is private; use the static constructing functions instead.
Interval supports all combinations of open and closed intervals: (a,b), (a,b], [a,b) and [a,b].
Intervals are immutable.
Definition at line 76 of file Interval.hpp.
| typedef T wns::Interval< T >::ValueType |
Definition at line 80 of file Interval.hpp.
| wns::Interval< T >::Interval | ( | ) | [inline] |
Definition at line 255 of file Interval.hpp.
| wns::Interval< T >::Interval | ( | const Endpoint & | a, | |
| const Endpoint & | b | |||
| ) | [inline, private] |
Definition at line 442 of file Interval.hpp.
| static BetweenEndpoint wns::Interval< T >::Between | ( | const ValueType & | a | ) | [inline, static] |
| a | (in) lower bound. |
Between(a).And(b). This creates the interval (a,b).
Definition at line 203 of file Interval.hpp.
| bool wns::Interval< T >::contains | ( | const Interval< T > & | x | ) | const [inline] |
| bool wns::Interval< T >::contains | ( | const ValueType & | x | ) | const [inline] |
| static Interval wns::Interval< T >::CreateFrom | ( | const pyconfig::View & | config | ) | [inline, static] |
| config | (in) Configuration specifying the endpoints. |
Definition at line 183 of file Interval.hpp.
| static Interval wns::Interval< T >::EmptyInterval | ( | ) | [inline, static] |
Definition at line 248 of file Interval.hpp.
| static FromEndpoint wns::Interval< T >::From | ( | const ValueType & | a | ) | [inline, static] |
| a | (in) lower bound. |
From(a).To(b). This creates the interval [a,b].
Definition at line 215 of file Interval.hpp.
| static FromInclExclEndpoint wns::Interval< T >::FromExcluding | ( | const ValueType & | a | ) | [inline, static] |
| a | (in) lower bound. |
FromExcluding(a).ToIncluding(b). This creates (a,b]. (You could also use FromExcluding(a).ToExcluding(b) but Between(a).And(b) is shorter.)
Definition at line 241 of file Interval.hpp.
| static FromInclExclEndpoint wns::Interval< T >::FromIncluding | ( | const ValueType & | a | ) | [inline, static] |
| a | (in) lower bound. |
FromIncluding(a).ToExcluding(b). This creates [a,b). (You could also use FromIncluding(a).ToIncluding(b) but From(a).To(b) is shorter.)
Definition at line 228 of file Interval.hpp.
| Interval wns::Interval< T >::intersect | ( | const Interval< T > & | x | ) | const [inline] |
| x | Intersect with that. |
Definition at line 433 of file Interval.hpp.
| bool wns::Interval< T >::isAbove | ( | const Interval< T > & | x | ) | const [inline] |
| x | Is that smaller? |
Definition at line 314 of file Interval.hpp.
| bool wns::Interval< T >::isAbove | ( | const ValueType & | x | ) | const [inline] |
| bool wns::Interval< T >::isBelow | ( | const Interval< T > & | x | ) | const [inline] |
| x | Is that larger? |
Definition at line 291 of file Interval.hpp.
| bool wns::Interval< T >::isBelow | ( | const ValueType & | x | ) | const [inline] |
| bool wns::Interval< T >::isEmpty | ( | ) | const [inline] |
| Interval wns::Interval< T >::join | ( | const Interval< T > & | x | ) | const [inline] |
| bool wns::Interval< T >::joinableWith | ( | const Interval< T > & | x | ) | const [inline] |
| x | Can we be joined with that? |
Definition at line 392 of file Interval.hpp.
| ValueType wns::Interval< T >::max | ( | ) | const [inline] |
| ValueType wns::Interval< T >::min | ( | ) | const [inline] |
| bool wns::Interval< T >::operator!= | ( | const Interval< T > & | x | ) | const [inline] |
Definition at line 268 of file Interval.hpp.
| bool wns::Interval< T >::operator== | ( | const Interval< T > & | x | ) | const [inline] |
Definition at line 263 of file Interval.hpp.
| bool wns::Interval< T >::overlaps | ( | const Interval< T > & | x | ) | const [inline] |
friend class Endpoint [friend] |
Definition at line 78 of file Interval.hpp.
Endpoint wns::Interval< T >::a [private] |
Definition at line 446 of file Interval.hpp.
Endpoint wns::Interval< T >::b [private] |
Definition at line 447 of file Interval.hpp.
1.5.5