Package org.antlr.misc
Class Interval
java.lang.Object
org.antlr.misc.Interval
An immutable inclusive interval a..b
-
Field Summary
FieldsModifier and TypeFieldDescriptionintint(package private) static Interval[]static intstatic intstatic final intstatic intstatic int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAre two intervals adjacent such as 0..41 and 42..42?static Intervalcreate(int a, int b) Interval objects are used readonly so share all with the same single value a==b up to some max size.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.booleanAre both ranges disjoint? I.e., no overlap?booleanintersection(Interval other) Return the interval in common between this and obooleanproperlyContains(Interval other) booleanstartsAfter(Interval other) Does this.a start after other.b? May or may not be disjointbooleanstartsAfterDisjoint(Interval other) Does this start completely after other? DisjointbooleanstartsAfterNonDisjoint(Interval other) Does this start after other? NonDisjointbooleanstartsBeforeDisjoint(Interval other) Does this start completely before other? DisjointbooleanstartsBeforeNonDisjoint(Interval other) Does this start at or before other? NondisjointtoString()Return the interval computed from combining this and other
-
Field Details
-
INTERVAL_POOL_MAX_VALUE
public static final int INTERVAL_POOL_MAX_VALUE- See Also:
-
cache
-
a
public int a -
b
public int b -
creates
public static int creates -
misses
public static int misses -
hits
public static int hits -
outOfRange
public static int outOfRange
-
-
Constructor Details
-
Interval
public Interval(int a, int b)
-
-
Method Details
-
create
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.g, 218623 IntervalSets have a..a (set with 1 element). -
equals
-
startsBeforeDisjoint
Does this start completely before other? Disjoint -
startsBeforeNonDisjoint
Does this start at or before other? Nondisjoint -
startsAfter
Does this.a start after other.b? May or may not be disjoint -
startsAfterDisjoint
Does this start completely after other? Disjoint -
startsAfterNonDisjoint
Does this start after other? NonDisjoint -
disjoint
Are both ranges disjoint? I.e., no overlap? -
adjacent
Are two intervals adjacent such as 0..41 and 42..42? -
properlyContains
-
union
Return the interval computed from combining this and other -
intersection
Return the interval in common between this and o -
differenceNotProperlyContained
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. -
toString
-