A DisjointRange is NOT a range, but a collection of non-overlapping (except at the edges) Ranges. It its BOUNDs (GetBounds) form a Range. More...
#include <DisjointRange.h>
Public Types | |
using | RangeType = RANGE_TYPE |
a Disjoint range collection of (disjoint) ranges of this type. | |
using | value_type = typename RangeType::value_type |
Range::value_type is the type of the contained elements of the range (say range of integers, value_type=int) | |
Public Member Functions | |
DisjointRange ()=default | |
nonvirtual Containers::Sequence< RangeType > | SubRanges () const |
nonvirtual bool | empty () const |
nonvirtual void | clear () |
nonvirtual bool | Contains (value_type elt) const |
nonvirtual RangeType | GetBounds () const |
nonvirtual RangeType | Closure () const |
like GetBounds (), but always returns a closed range | |
constexpr bool | operator== (const DisjointRange &rhs) const |
A DisjointRange is NOT a range, but a collection of non-overlapping (except at the edges) Ranges. It its BOUNDs (GetBounds) form a Range.
DiscreteRange<> is an immutable type (once constructed, will never change), except for allowing operator=.
Definition at line 48 of file DisjointRange.h.
|
default |
You can pass in empty Ranges, ranges out of order, and overlapping ranges, and the constructor always filters out empty ranges, and re-order so subranges well-ordered and disjoint.
auto Stroika::Foundation::Traversal::DisjointRange< T, RANGE_TYPE >::SubRanges | ( | ) | const |
A disjoint range is made up of a finite number of disjoint (non-overlapping) subranges, which are arranged following the natural ordering intrinsic to the value_type. This returns those subranges.
Definition at line 44 of file DisjointRange.inl.
bool Stroika::Foundation::Traversal::DisjointRange< T, RANGE_TYPE >::empty | ( | ) | const |
Containing no points (same as containing no subranges).
Definition at line 54 of file DisjointRange.inl.
void Stroika::Foundation::Traversal::DisjointRange< T, RANGE_TYPE >::clear | ( | ) |
Same as *this = DisjointRange ()
Definition at line 59 of file DisjointRange.inl.
bool Stroika::Foundation::Traversal::DisjointRange< T, RANGE_TYPE >::Contains | ( | value_type | elt | ) | const |
This returns true if r is contained in some sub-element range. This is only the smae as GetBounds().Contains() if SubRanges ().size () <= 1.
Definition at line 64 of file DisjointRange.inl.
RANGE_TYPE Stroika::Foundation::Traversal::DisjointRange< T, RANGE_TYPE >::GetBounds | ( | ) | const |
if empty, returns empty range()
//
Definition at line 77 of file DisjointRange.inl.
RANGE_TYPE Stroika::Foundation::Traversal::DisjointRange< T, RANGE_TYPE >::Closure | ( | ) | const |
like GetBounds (), but always returns a closed range
//
Definition at line 93 of file DisjointRange.inl.
|
constexpr |
This returns true if the constituent subranges are all equal. This amounts to checking if the 'covered points' are all equal.
Definition at line 361 of file DisjointRange.inl.