- add
void add(int el)
Add a single element to the set. An isolated element is stored
as a range el..el.
@uml
@override
- add
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
void add(Interval addition)
copy on write so we can cache a..a intervals and sets of that
- addAll
IntervalSet addAll(IntSet set)
Undocumented in source. Be warned that the author may not have intended to support it.
- and
IntervalSet and(IntSet other)
Undocumented in source. Be warned that the author may not have intended to support it.
- clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
- complement
IntervalSet complement(int minElement, int maxElement)
Undocumented in source. Be warned that the author may not have intended to support it.
- complement
IntervalSet complement(IntSet vocabulary)
- complement
IntervalSet complement(IntervalSet vocabulary)
Undocumented in source. Be warned that the author may not have intended to support it.
- contains
bool contains(int el)
Undocumented in source. Be warned that the author may not have intended to support it.
- elementName
string elementName(Vocabulary vocabulary, int a)
Undocumented in source. Be warned that the author may not have intended to support it.
- get
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.
@uml
@safe
@pure
- getMaxElement
int getMaxElement()
Returns the maximum value contained in the set.
- getMinElement
int getMinElement()
Returns the minimum value contained in the set.
- getSingleElement
int getSingleElement()
Undocumented in source. Be warned that the author may not have intended to support it.
- intervals
Interval[] intervals()
- isNil
bool isNil()
Undocumented in source. Be warned that the author may not have intended to support it.
- isReadonly
bool isReadonly()
- opEquals
bool opEquals(Object obj)
- or
IntervalSet or(IntSet a)
Undocumented in source. Be warned that the author may not have intended to support it.
- remove
void remove(int el)
Undocumented in source. Be warned that the author may not have intended to support it.
- setReadonly
void setReadonly(bool readonly)
- size
int size()
Undocumented in source. Be warned that the author may not have intended to support it.
- subtract
IntervalSet subtract(IntSet a)
Undocumented in source. Be warned that the author may not have intended to support it.
- subtract
IntervalSet subtract(IntervalSet left, IntervalSet right)
Compute the set difference between two interval sets. The specific
operation is {@code left - right}. If either of the input sets is
{@code null}, it is treated as though it was an empty set.
- toArray
int[] toArray()
Undocumented in source. Be warned that the author may not have intended to support it.
- toIntegerList
IntegerList toIntegerList()
Undocumented in source. Be warned that the author may not have intended to support it.
- toList
int[] toList()
Undocumented in source. Be warned that the author may not have intended to support it.
- toSet
RedBlackTree!int toSet()
Undocumented in source. Be warned that the author may not have intended to support it.
- toString
string toString(bool elemAreChar)
Undocumented in source. Be warned that the author may not have intended to support it.
- toString
string toString()
- toString
string toString(Vocabulary vocabulary)
Undocumented in source. Be warned that the author may not have intended to support it.
This class implements the {@link IntSet} backed by a sorted array of non-overlapping intervals. It is particularly efficient for representing large collections of numbers, where the majority of elements appear as part of a sequential range of numbers that are all part of the set. For example, the set { 1, 2, 3, 4, 7, 8 } may be represented as { [1, 4], [7, 8] }.
<p> This class is able to represent sets containing any combination of values in the range {@link Integer#MIN_VALUE} to {@link Integer#MAX_VALUE} (inclusive).</p>