Interval<T extends Comparable<T> > class
An interval over a continuous ordering of type T.
Contrary to the Range collection, this object includes both the lower and upper endpoint and provides efficient means to compute the intersection and union between objects.
- Available extensions
- Annotations
-
- @immutable
Constructors
- Interval(T lower, [T? upper])
-
Creates an interval between
lowerandupper(inclusive):{ x ∈ T | lower <= x <= upper }.
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- isSingle → bool
-
Whether this interval consists of a single value.
no setter
- lower → T
-
The lower bound of this interval.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- upper → T
-
The upper bound of this interval.
final
Methods
-
contains(
T value) → bool -
Whether
valueis included in this interval. -
difference(
Interval< T> other) → List<Interval< T> > -
Returns the difference of this interval minus
otherinterval as a list of zero, one, or two disjoint intervals. -
encloses(
Interval< T> other) → bool -
Whether this interval completely covers
other. -
intersection(
Interval< T> other) → Interval<T> ? -
Returns the interval where this and
otherinterval overlap. If the intervals do not intersect, returnnull. -
intersects(
Interval< T> other) → bool -
Whether this interval and
otheroverlap. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
span(
Interval< T> other) → Interval<T> -
Returns the minimal interval (convex hull) spanning this and
otherinterval. -
toDuration(
) → Duration -
Available on Interval<
Converts an Interval of DateTime objects into a Duration.DateTime> , provided by the DurationIntervalDateTimeExtension extension -
toString(
) → String -
A string representation of this object.
override
-
union(
Interval< T> other) → Interval<T> -
Returns the minimal interval enclosing this and
otherinterval.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override