Class that represents an interval. More...

#include <SPL/Runtime/Utility/Interval.h>

Detailed Description

template<typename T>
class SPL::interval< T >

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.

Template Parameters
T the type of elements of the interval. The endpoint type must be totally ordered.

Constructor & Destructor Documentation

◆ interval() [1/4]

template<typename T >

Constructs an empty interval.

◆ interval() [2/4]

template<typename T >

Constructs an empty interval which has a left endpoint specified by endpoint.

Parameters

◆ interval() [3/4]

template<typename T >

Copy constructor.

Parameters

◆ interval() [4/4]

template<typename T >

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.

Parameters
Exceptions

Member Function Documentation

◆ operator=()

template<typename T >

Assignment operator.

Parameters

◆ operator==()

template<typename T >

Equality comparison.

Parameters
Returns
true if the intervals are the same, otherwise false

◆ left()

template<typename T >

Get left (low) endpoint.

Returns
the left endpoint

◆ right()

template<typename T >

Get right (high) endpoint.

Returns
the right endpoint

◆ empty()

template<typename T >

Determines whether the interval is empty.

An interval is empty iff its left endpoint equals its right endpoint.

Returns
true if the interval is empty, otherwise false

◆ touches()

template<typename T >

Determines whether this interval touches the other.

Interval a touches interval b iff a.left() == b.right() or a.right() == b.left().

Parameters
Returns
true if this interval touches the other, otherwise false

◆ overlaps()

template<typename T >

Determines whether this overlaps touches the other.

Interval a overlaps interval b iff a.left() < b.right() or a.right() > b.left().

Parameters
Returns
true if this interval overlaps the other, otherwise false

◆ includes()

template<typename T >

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.

Parameters
Returns
true if this interval includes the givem timestamp, otherwise false

◆ swap()

template<typename T >

Swap with another interval.

Parameters

◆ hashCode()

template<typename T >

Calculates hash code.

Returns
hash code

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