The type of the ranges this set is expected to hold.
Checks whether this set is empty, i.e. whether RangeSet.subranges
is an empty array.
Returns the array of the underlying ranges of this set.
The resulting ranges are guaranteed not to intersect with each other, nor to be adjacent to any of them.
Add another range set to this set, merging intersecting/adjacent ranges.
This operation modifies this
, but keeps other
untouched.
The other range set to add values from. It is possible to add a range set built with a different underlying tree implementation.
Add a range to this set, merging intersecting/adjacent ranges.
This operation modifies this
.
The range to add values from.
Clear the underlying tree, thus resetting this
to an empty set.
Finds a range containing the provided value.
"Infinity" values cannot be contained, and therefore always return undefined
.
The value to check the containment of.
The range that Range.contains
value
if found, or undefined
otherwise.
Checks whether any of the ranges within this set contains value
.
"Infinity" values cannot be contained, and therefore always return false
.
The value to check the containment of.
Checks whether any of the ranges within this set contains range
.
See Range.contains
for details of how this check is performed.
An empty range is always contained in any set. An empty set contains no ranges but an empty range.
A range with an infinite bound contains other ranges with the same infinite bound, even though infinity itself cannot be contained.
Finds a range enclosing the provided range.
Enclosing means containing all the elements of range
within the resulting range.
Note: an empty range is not enclosed by any other range.
The value to be enclosed by the return.
The range that Range.contains
range
if found, except an empty range, or undefined
otherwise.
Subtract every range from the provided range set from this set.
This operation modifies this
, but keeps other
untouched.
This operation relies on Range.union
.
The other range set containing the ranges to subtract. It is possible to subtract a range set built with a different underlying tree implementation.
Subtract other
from this set.
This operation modifies this
.
This operation relies on Range.subtract
.
The range to subtract.
A shorthand constructor for numeric ranges.
An optional constructor for the underlying tree.
Defaults to [[BintreeRBRangeSetTree
]].
A range set built around JS number
.
A constructor method for a range set of any custom type T
.
the type of the resulting range set.
See RangeSpec
An optional constructor for the underlying tree.
Defaults to [[BintreeRBRangeSetTree
]].
Generated using TypeDoc
A set of non-intersecting ranges.
This class provides operators for combining, subtracting, and querying sets of ranges of an arbitrary type
T
. It automatically merges adjacent/intersecting ranges after each operation, guaranteeing the smallest possible number of subranges for every set of underlying ranges it represents.This class is mutable for performance reasons.
This implementation is backed by a tree implementation conforming to
RangeSetTree
. The default implementation isbintrees
' [[BintreeRBRangeSetTree
]].