| java.lang.Object org.antlr.misc.Interval
Interval | public class Interval (Code) | | An immutable inclusive interval a..b
|
Constructor Summary | |
public | Interval(int a, int b) |
INTERVAL_POOL_MAX_VALUE | final public static int INTERVAL_POOL_MAX_VALUE(Code) | | |
Interval | public Interval(int a, int b)(Code) | | |
adjacent | public boolean adjacent(Interval other)(Code) | | Are two intervals adjacent such as 0..41 and 42..42?
|
create | public static Interval create(int a, int b)(Code) | | 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).
public static Interval create(int a, int b) {
if ( a!=b || a<0 || a>INTERVAL_POOL_MAX_VALUE ) {
return new Interval(a,b);
}
if ( intervals[a]==null ) {
intervals[a] = new Interval(a,a);
}
return intervals[a];
}
ACK! Fuond out that add() actually modifies intervals. :(
|
differenceNotProperlyContained | public Interval differenceNotProperlyContained(Interval other)(Code) | | 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 | public boolean disjoint(Interval other)(Code) | | Are both ranges disjoint? I.e., no overlap?
|
intersection | public Interval intersection(Interval other)(Code) | | Return the interval in common between this and o
|
startsAfter | public boolean startsAfter(Interval other)(Code) | | Does this.a start after other.b? May or may not be disjoint
|
startsAfterDisjoint | public boolean startsAfterDisjoint(Interval other)(Code) | | Does this start completely after other? Disjoint
|
startsAfterNonDisjoint | public boolean startsAfterNonDisjoint(Interval other)(Code) | | Does this start after other? NonDisjoint
|
startsBeforeDisjoint | public boolean startsBeforeDisjoint(Interval other)(Code) | | Does this start completely before other? Disjoint
|
startsBeforeNonDisjoint | public boolean startsBeforeNonDisjoint(Interval other)(Code) | | Does this start at or before other? Nondisjoint
|
|
|