Interval

@uml An immutable inclusive interval a..b

Constructors

this
this(int a, int b)

@uml @pure @safe

Members

Functions

adjacent
bool adjacent(Interval other)

@uml Are two intervals adjacent such as 0..41 and 42..42? @pure @safe

differenceNotProperlyContained
Interval differenceNotProperlyContained(Interval other)

@uml 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. @safe

disjoint
bool disjoint(Interval other)

@uml Are both ranges disjoint? I.e., no overlap? @pure @safe

equals
bool equals(Object o)

@uml @pure @safe

hashCode
int hashCode()

@uml @pure @safe

intersection
Interval intersection(Interval other)

@uml Return the interval in common between this and o @safe

length
int length()

@uml 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. @pure @safe

properlyContains
bool properlyContains(Interval other)

@uml @pure @safe

startsAfter
bool startsAfter(Interval other)

@uml Does this.a start after other.b? May or may not be disjoint @pure @safe

startsAfterDisjoint
bool startsAfterDisjoint(Interval other)

@uml Does this start completely after other? Disjoint @pure @safe

startsAfterNonDisjoint
bool startsAfterNonDisjoint(Interval other)

@uml Does this start after other? NonDisjoint @pure @safe

startsBeforeDisjoint
bool startsBeforeDisjoint(Interval other)

@uml Does this start completely before other? Disjoint @pure @safe

startsBeforeNonDisjoint
bool startsBeforeNonDisjoint(Interval other)

@uml Does this start at or before other? Nondisjoint @pure @safe

toString
string toString()

@uml @override @pure @safe

unionInterval
Interval unionInterval(Interval other)

@uml Return the interval computed from combining this and other @safe

Static functions

of
Interval of(int a, int b)

@uml 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). @safe

Static variables

INVALID
Interval INVALID;
Undocumented in source.
creates
int creates;
Undocumented in source.
hits
int hits;
Undocumented in source.
misses
int misses;
Undocumented in source.
outOfRange
int outOfRange;
Undocumented in source.

Variables

INTERVAL_POOL_MAX_VALUE
enum int INTERVAL_POOL_MAX_VALUE;
Undocumented in source.
a
int a;
Undocumented in source.
b
int b;
Undocumented in source.

Meta