|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Closed interval [low, high]. More...
#include <tpl_interval_tree.H>
Public Member Functions | |
| Interval () noexcept(std::is_nothrow_default_constructible_v< T >) | |
| Initializes the interval as [T{}, T{}]. | |
| Interval (const T &lo, const T &hi) noexcept(std::is_nothrow_copy_constructible_v< T >) | |
| Construct interval [lo, hi]. | |
| Interval (T &&lo, T &&hi) noexcept(std::is_nothrow_move_constructible_v< T >) | |
| Construct interval [lo, hi] (move version). | |
| template<class Compare = Aleph::less<T>> | |
| bool | overlaps (const Interval &other, const Compare &cmp=Compare()) const noexcept(std::is_nothrow_invocable_v< const Compare &, const T &, const T & >) |
Return true if this interval overlaps with other. | |
| template<class Compare = Aleph::less<T>> | |
| bool | contains (const T &p, const Compare &cmp=Compare()) const noexcept(std::is_nothrow_invocable_v< const Compare &, const T &, const T & >) |
Return true if this interval contains the point p. | |
| template<class Compare = Aleph::less<T>> | |
| bool | is_valid (const Compare &cmp=Compare()) const noexcept(std::is_nothrow_invocable_v< const Compare &, const T &, const T & >) |
| Return true if low <= high. | |
| bool | operator== (const Interval &other) const noexcept(noexcept(std::declval< const T & >()==std::declval< const T & >())) |
| Equality operator. | |
| bool | operator!= (const Interval &other) const noexcept(noexcept(*this==other)) |
| Inequality operator. | |
Static Public Member Functions | |
| static Interval | point (const T &p) noexcept(std::is_nothrow_copy_constructible_v< T >) |
| Construct a point interval [p, p]. | |
Public Attributes | |
| T | low |
| Lower endpoint. | |
| T | high |
| Upper endpoint. | |
Closed interval [low, high].
Represents a closed interval with endpoints of type T. All comparisons use a functor so custom types work.
| T | Endpoint type (must be totally ordered). |
Definition at line 90 of file tpl_interval_tree.H.
|
inlinenoexcept |
Initializes the interval as [T{}, T{}].
| none |
Definition at line 98 of file tpl_interval_tree.H.
|
inlinenoexcept |
Construct interval [lo, hi].
| [in] | lo | Lower endpoint. |
| [in] | hi | Upper endpoint. |
| none |
Definition at line 107 of file tpl_interval_tree.H.
|
inlinenoexcept |
Construct interval [lo, hi] (move version).
| [in] | lo | Lower endpoint. |
| [in] | hi | Upper endpoint. |
| none |
Definition at line 116 of file tpl_interval_tree.H.
|
inlinenoexcept |
Return true if this interval contains the point p.
| Compare | Comparison functor type (must represent ascending less-than). |
| [in] | p | the query point. |
| [in] | cmp | Comparison functor for endpoints. |
| none |
Definition at line 155 of file tpl_interval_tree.H.
References Aleph::and, cmp(), Aleph::divide_and_conquer_partition_dp(), Aleph::Interval< T >::high, and Aleph::Interval< T >::low.
Referenced by TEST_F().
|
inlinenoexcept |
Return true if low <= high.
| Compare | Comparison functor type (must represent ascending less-than). |
| [in] | cmp | Comparison functor for endpoints. |
| none |
Definition at line 169 of file tpl_interval_tree.H.
References cmp(), Aleph::divide_and_conquer_partition_dp(), Aleph::Interval< T >::high, and Aleph::Interval< T >::low.
Referenced by TEST_F().
|
inlinenoexcept |
Inequality operator.
| [in] | other | Interval to compare with. |
| none |
Definition at line 191 of file tpl_interval_tree.H.
References Aleph::divide_and_conquer_partition_dp().
|
inlinenoexcept |
Equality operator.
| [in] | other | Interval to compare with. |
| none |
Definition at line 180 of file tpl_interval_tree.H.
References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Interval< T >::high, and Aleph::Interval< T >::low.
|
inlinenoexcept |
Return true if this interval overlaps with other.
| Compare | Comparison functor type (must represent ascending less-than). |
| [in] | other | The other interval. |
| [in] | cmp | Comparison functor for endpoints. |
| none |
Definition at line 139 of file tpl_interval_tree.H.
References Aleph::and, cmp(), Aleph::divide_and_conquer_partition_dp(), Aleph::Interval< T >::high, and Aleph::Interval< T >::low.
Referenced by TEST_F().
Construct a point interval [p, p].
| [in] | p | The point value. |
| none |
Definition at line 125 of file tpl_interval_tree.H.
Referenced by Aleph::Gen_Interval_Tree< NodeType, T, Compare >::find_stab(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::stab(), TEST_F(), and TEST_F().
| T Aleph::Interval< T >::high |
Upper endpoint.
Definition at line 93 of file tpl_interval_tree.H.
Referenced by Aleph::Gen_Interval_Tree< NodeType, T, Compare >::all_overlaps(), Aleph::Interval< T >::contains(), Aleph::Interval< T >::is_valid(), Aleph::Interval< T >::operator==(), Aleph::Interval< T >::overlaps(), and TEST_F().
| T Aleph::Interval< T >::low |
Lower endpoint.
Definition at line 92 of file tpl_interval_tree.H.
Referenced by Aleph::Gen_Interval_Tree< NodeType, T, Compare >::all_overlaps(), Aleph::Interval< T >::contains(), Aleph::Interval< T >::is_valid(), Aleph::Interval< T >::operator==(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::overlap_search(), Aleph::Interval< T >::overlaps(), TEST(), and TEST_F().