Interval class

An immutable inclusive interval a..b */

Constructors

Interval(int a, int b)

Properties

a int
getter/setter pair
b int
getter/setter pair
hashCode int
The hash code for this object.
no setteroverride
length int
return number of elements between a and b inclusively. x..x is length 1. if b < a, then length is 0. 9..10 has length 2.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

adjacent(Interval other) bool
Are two intervals adjacent such as 0..41 and 42..42? */
differenceNotProperlyContained(Interval other) Interval?
Return the interval with elements from this not in other; other must not be totally enclosed (properly contained) within this, which would result in two disjoint intervals instead of the single one returned by this method.
disjoint(Interval other) bool
Are both ranges disjoint? I.e., no overlap? */
intersection(Interval other) Interval
Return the interval in common between this and o */
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
properlyContains(Interval other) bool
startsAfter(Interval other) bool
Does this.a start after other.b? May or may not be disjoint */
startsAfterDisjoint(Interval other) bool
Does this start completely after other? Disjoint */
startsAfterNonDisjoint(Interval other) bool
Does this start after other? NonDisjoint */
startsBeforeDisjoint(Interval other) bool
Does this start completely before other? Disjoint */
startsBeforeNonDisjoint(Interval other) bool
Does this start at or before other? Nondisjoint */
toString() String
A string representation of this object.
override
union(Interval other) Interval
Return the interval computed from combining this and other */

Operators

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

Static Properties

cache List<Interval?>
getter/setter pair
creates int
getter/setter pair
hits int
getter/setter pair
INTERVAL_POOL_MAX_VALUE int
final
INVALID Interval
final
misses int
getter/setter pair
outOfRange int
getter/setter pair

Static Methods

of(int a, int b) Interval
Interval objects are used readonly so share all with the same single value a==b up to some max size. Use an array as a perfect hash. Return shared object for 0..INTERVAL_POOL_MAX_VALUE or a new Interval object with a..a in it. On Java.g4, 218623 IntervalSets have a..a (set with 1 element).