Package org.antlr.v4.runtime.misc
Class Interval
- java.lang.Object
- 
- org.antlr.v4.runtime.misc.Interval
 
- 
 public class Interval extends Object An immutable inclusive interval a..b
- 
- 
Field SummaryFields Modifier and Type Field Description intaintbstatic intINTERVAL_POOL_MAX_VALUEstatic IntervalINVALID
 - 
Constructor SummaryConstructors Constructor Description Interval(int a, int b)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadjacent(Interval other)Are two intervals adjacent such as 0..41 and 42..42?IntervaldifferenceNotProperlyContained(Interval other)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.booleandisjoint(Interval other)Are both ranges disjoint? I.e., no overlap?booleanequals(Object o)inthashCode()Intervalintersection(Interval other)Return the interval in common between this and ointlength()return number of elements between a and b inclusively.static Intervalof(int a, int b)Interval objects are used readonly so share all with the same single value a==b up to some max size.booleanproperlyContains(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? NondisjointStringtoString()Intervalunion(Interval other)Return the interval computed from combining this and other
 
- 
- 
- 
Field Detail- 
INTERVAL_POOL_MAX_VALUEpublic static final int INTERVAL_POOL_MAX_VALUE - See Also:
- Constant Field Values
 
 - 
INVALIDpublic static final Interval INVALID 
 - 
apublic int a 
 - 
bpublic int b 
 
- 
 - 
Method Detail- 
ofpublic static Interval of(int a, int b) 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).
 - 
lengthpublic int length() 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.
 - 
startsBeforeDisjointpublic boolean startsBeforeDisjoint(Interval other) Does this start completely before other? Disjoint
 - 
startsBeforeNonDisjointpublic boolean startsBeforeNonDisjoint(Interval other) Does this start at or before other? Nondisjoint
 - 
startsAfterpublic boolean startsAfter(Interval other) Does this.a start after other.b? May or may not be disjoint
 - 
startsAfterDisjointpublic boolean startsAfterDisjoint(Interval other) Does this start completely after other? Disjoint
 - 
startsAfterNonDisjointpublic boolean startsAfterNonDisjoint(Interval other) Does this start after other? NonDisjoint
 - 
disjointpublic boolean disjoint(Interval other) Are both ranges disjoint? I.e., no overlap?
 - 
adjacentpublic boolean adjacent(Interval other) Are two intervals adjacent such as 0..41 and 42..42?
 - 
properlyContainspublic boolean properlyContains(Interval other) 
 - 
unionpublic Interval union(Interval other) Return the interval computed from combining this and other
 - 
intersectionpublic Interval intersection(Interval other) Return the interval in common between this and o
 - 
differenceNotProperlyContainedpublic Interval differenceNotProperlyContained(Interval other) 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.
 
- 
 
-