Interval<T> class

An interval over an ordering of type T.

See https://en.wikipedia.org/wiki/Interval_(mathematics).

Available Extensions

Constructors

Interval.all({Comparator<T>? comparator})
Returns a interval containing all values of type T: { x ∈ T }
factory
Interval.atLeast(T lower, {Comparator<T>? comparator})
Returns a interval containing { x ∈ T | lower <= x }.
factory
Interval.atMost(T upper, {Comparator<T>? comparator})
Returns a interval containing { x ∈ T | x <= upper }.
factory
Interval.closed(T lower, T upper, {Comparator<T>? comparator})
Returns a interval containing { x ∈ T | lower <= x <= upper }.
factory
Interval.closedOpen(T lower, T upper, {Comparator<T>? comparator})
Returns a interval containing { x ∈ T | lower <= x < upper }.
factory
Interval.empty({Comparator<T>? comparator})
Returns an empty interval of type T: {} = ∅
factory
Interval.greaterThan(T lower, {Comparator<T>? comparator})
Returns a interval containing { x ∈ T | lower < x }.
factory
Interval.lessThan(T upper, {Comparator<T>? comparator})
Returns a interval containing { x ∈ T | x < upper }.
factory
Interval.open(T lower, T upper, {Comparator<T>? comparator})
Returns a interval containing { x ∈ T | lower < x < upper }.
factory
Interval.openClosed(T lower, T upper, {Comparator<T>? comparator})
Returns a interval containing { x ∈ T | lower < x <= upper }.
factory
Interval.single(T value, {Comparator<T>? comparator})
Returns an interval containing a single value of type T: { x ∈ T | x = value }.
factory

Properties

comparator Comparator<T>
Returns the underlying comparator of this interval.
final
hashCode int
The hash code for this object.
no setteroverride
isEmpty bool
Returns true, if this is an empty interval.
no setter
isNotEmpty bool
Returns true, if this is a non-empty interval.
no setter
isSingle bool
Returns true, if this is a degenerated interval with a single value.
no setter
lower → LowerBound<T>
Returns the upper bound of this interval.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
upper → UpperBound<T>
Returns the lower bound of this interval.
final

Methods

contains(T value) bool
Returns true, if the value is included in this interval.
intersection(Interval<T> other) Interval<T>
Returns the interaction of this interval and other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
span(Interval<T> other) Interval<T>
Returns the minimal interval enclosing this interval and other.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override