| Modifier and Type | Field and Description |
|---|---|
| public static final IntervalSet | |
| protected List | intervals
The list of sorted, disjoint intervals. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| protected void | |
| public void | addAll(IntSet set)
Implements org. |
| public IntervalSet | and(IntSet other)
Implements org. |
| public IntervalSet | |
| public IntervalSet | complement(IntSet vocabulary)
Implements org. |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Implements org. |
| public int | |
| public List | |
| public int | |
| public int | |
| public int | getSingleElement()
Implements org. |
| public boolean | |
| public boolean | |
| public static IntervalSet | |
| public static IntervalSet | |
| public IntSet | |
| public void | |
| public int | size()
Implements org. |
| public IntervalSet | subtract(IntSet other)
Implements org. |
| public int[] | |
| public List | |
| public BitSet | |
| public String | toString()
Overrides java. Implements org. |
| public String |
| COMPLETE_SET | back to summary |
|---|---|
| public static final IntervalSet COMPLETE_SET | |
| intervals | back to summary |
|---|---|
| protected List<Interval> intervals The list of sorted, disjoint intervals. | |
| IntervalSet | back to summary |
|---|---|
| public IntervalSet() Create a set with no elements | |
| IntervalSet | back to summary |
|---|---|
| public IntervalSet(List<Interval> intervals) | |
| add | back to summary |
|---|---|
| public void add(int el) Implements org. Add a single element to the set. An isolated element is stored as a range el..el.
| |
| add | back to summary |
|---|---|
| public void add(int a, int b) Add interval; i.e., add all integers from a to b to set. If b<a, do nothing. Keep list in sorted order (by left range value). If overlap, combine ranges. For example, If this is {1..5, 10..20}, adding 6..7 yields {1..5, 6..7, 10..20}. Adding 4..8 yields {1..8, 10..20}. | |
| add | back to summary |
|---|---|
| protected void add(Interval addition) | |
| addAll | back to summary |
|---|---|
| public void addAll(IntSet set) Implements org. Doc from org. Add all elements from incoming set to this set. Can limit to set of its own type.
| |
| and | back to summary |
|---|---|
| public IntervalSet and(IntSet other) Implements org. Return a new set with the intersection of this set with other. Because the intervals are sorted, we can use an iterator for each list and just walk them together. This is roughly O(min(n,m)) for interval list lengths n and m.
| |
| complement | back to summary |
|---|---|
| public IntervalSet complement(int minElement, int maxElement) | |
| complement | back to summary |
|---|---|
| public IntervalSet complement(IntSet vocabulary) Implements org. Given the set of possible values (rather than, say UNICODE or MAXINT), return a new set containing all elements in vocabulary, but not in this. The computation is (vocabulary - this). 'this' is assumed to be either a subset or equal to vocabulary.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Implements org. Are two IntervalSets equal? Because all intervals are sorted and disjoint, equals is a simple linear walk over both lists to make sure they are the same. Interval.equals() is used by the List.equals() method to check the ranges.
| |
| get | back to summary |
|---|---|
| public int get(int i) Get the ith element of ordered set. Used only by RandomPhrase so don't bother to implement if you're not doing that for a new ANTLR code gen target. | |
| getIntervals | back to summary |
|---|---|
| public List Return a list of Interval objects. | |
| getMaxElement | back to summary |
|---|---|
| public int getMaxElement() | |
| getMinElement | back to summary |
|---|---|
| public int getMinElement() Return minimum element >= 0 | |
| getSingleElement | back to summary |
|---|---|
| public int getSingleElement() Implements org. If this set is a single integer, return it otherwise Label.INVALID
| |
| isNil | back to summary |
|---|---|
| public boolean isNil() Implements org. return true if this set has no members
| |
| member | back to summary |
|---|---|
| public boolean member(int el) Implements org. Is el in any range of this set?
| |
| of | back to summary |
|---|---|
| public static IntervalSet of(int a) Create a set with a single element, el. | |
| of | back to summary |
|---|---|
| public static IntervalSet of(int a, int b) Create a set with all ints within range [a..b] (inclusive) | |
| or | back to summary |
|---|---|
| public IntSet or(IntSet a) Implements org. Todo implement this!
| |
| remove | back to summary |
|---|---|
| public void remove(int el) Implements org. Doc from org. remove this element from this set
| |
| size | back to summary |
|---|---|
| public int size() Implements org. Doc from org. Return the size of this set (not the underlying implementation's allocated memory size, for example).
| |
| subtract | back to summary |
|---|---|
| public IntervalSet subtract(IntSet other) Implements org. Compute this-other via this&~other. Return a new set containing all elements in this but not in other. other is assumed to be a subset of this; anything that is in other but not in this will be ignored.
| |
| toArray | back to summary |
|---|---|
| public int[] toArray() | |
| toList | back to summary |
|---|---|
| public List Implements org.
| |
| toRuntimeBitSet | back to summary |
|---|---|
| public BitSet toRuntimeBitSet() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Implements org. Doc from java. Returns a string representation of the object. | |
| toString | back to summary |
|---|---|
| public String toString(Grammar g) Implements org.
| |