Class that represents an interval. More...
#include <SPL/Runtime/Utility/Interval.h>
Public Member Functions |
|
| interval () | |
| Constructs an empty interval. More... |
|
| interval (T endpoint) | |
Constructs an empty interval which has a left endpoint specified by endpoint. More... |
|
| interval (const interval &other) | |
| Copy constructor. More... |
|
| interval const & | operator= (interval const &other) |
| Assignment operator. More... |
|
| bool | operator== (interval const &other) const |
| Equality comparison. More... |
|
| interval (T value, T size) | |
| Constructs an interval specified by its left endpoint and a size. More... |
|
| T const & | left () const |
| Get left (low) endpoint. More... |
|
| T const & | right () const |
| Get right (high) endpoint. More... |
|
| bool | empty () const |
| Determines whether the interval is empty. More... |
|
| bool | touches (interval< T > other) const |
Determines whether this interval touches the other. More... |
|
| bool | overlaps (interval< T > other) const |
Determines whether this overlaps touches the other. More... |
|
| bool | includes (const SPL::timestamp &ts) const |
Determines whether this interval includes the specified timestamp. More... |
|
| void | swap (interval &other) |
Swap with another interval. More... |
|
| size_t | hashCode () const |
| Calculates hash code. More... |
|
Class that represents an interval.
This interval is right-open, which means that it contains all the elements between (and including) its left endpoint, and (excluding) its right endpoint.
| T | the type of elements of the interval. The endpoint type must be totally ordered. |
|
inline |
Constructs an empty interval.
|
inline |
Constructs an empty interval which has a left endpoint specified by endpoint.
| endpoint | the left interval endpoint |
|
inline |
Copy constructor.
| other | other interval |
|
inline |
Constructs an interval specified by its left endpoint and a size.
The endpoint type must be Addable and Subtractable, so it must have operator + and an operator - defined.
| value | the left endpoint |
| size | the distance between the left and the right endpoint |
| std::invalid_argument | if the size is negative |
|
inline |
Assignment operator.
| other | another interval |
|
inline |
Equality comparison.
| other | interval to compare with |
true if the intervals are the same, otherwise false
|
inline |
Get left (low) endpoint.
|
inline |
Get right (high) endpoint.
|
inline |
Determines whether the interval is empty.
An interval is empty iff its left endpoint equals its right endpoint.
true if the interval is empty, otherwise false
|
inline |
Determines whether this interval touches the other.
Interval a touches interval b iff a.left() == b.right() or a.right() == b.left().
| other | the other interval |
true if this interval touches the other, otherwise false
|
inline |
Determines whether this overlaps touches the other.
Interval a overlaps interval b iff a.left() < b.right() or a.right() > b.left().
| other | the other interval |
true if this interval overlaps the other, otherwise false
|
inline |
Determines whether this interval includes the specified timestamp.
This interval includes a timestamp if the timestamp is larger or equal to the left endpoint and it is smaller than the right endpoint.
| ts | a timestamp |
true if this interval includes the givem timestamp, otherwise false
|
inline |
Swap with another interval.
| other | interval to swap with |
|
inline |
Calculates hash code.