public interface IntSet
IntervalSet| Modifier and Type | Method and Description |
|---|---|
void |
add(int el)
Adds the specified value to the current set.
|
IntSet |
addAll(IntSet set)
Modify the current
IntSet object to contain all elements that are
present in itself, the specified set, or both. |
IntSet |
and(IntSet a)
Return a new
IntSet object containing all elements that are
present in both the current set and the specified set a. |
IntSet |
complement(IntSet elements)
Return a new
IntSet object containing all elements that are
present in elements but not present in the current set. |
boolean |
contains(int el)
Returns
true if the set contains the specified element. |
boolean |
equals(java.lang.Object obj) |
int |
getSingleElement()
Returns the single value contained in the set, if
size() is 1;
otherwise, returns Token.INVALID_TYPE. |
boolean |
isNil()
Returns
true if this set contains no elements. |
IntSet |
or(IntSet a)
Return a new
IntSet object containing all elements that are
present in the current set, the specified set a, or both. |
void |
remove(int el)
Removes the specified value from the current set.
|
int |
size()
Return the total number of elements represented by the current set.
|
IntSet |
subtract(IntSet a)
Return a new
IntSet object containing all elements that are
present in the current set but not present in the input set a. |
java.util.List<java.lang.Integer> |
toList()
Return a list containing the elements represented by the current set.
|
java.lang.String |
toString() |
void add(int el)
el - the value to addjava.lang.IllegalStateException - if the current set is read-onlyIntSet addAll(IntSet set)
IntSet object to contain all elements that are
present in itself, the specified set, or both.set - The set to add to the current set. A null argument is
treated as though it were an empty set.this (to support chained calls)java.lang.IllegalStateException - if the current set is read-onlyIntSet and(IntSet a)
IntSet object containing all elements that are
present in both the current set and the specified set a.a - The set to intersect with the current set. A null
argument is treated as though it were an empty set.IntSet instance containing the intersection of the
current set and a. The value null may be returned in
place of an empty result set.IntSet complement(IntSet elements)
IntSet object containing all elements that are
present in elements but not present in the current set. The
following expressions are equivalent for input non-null IntSet
instances x and y.
x.complement(y)y.subtract(x)elements - The set to compare with the current set. A null
argument is treated as though it were an empty set.IntSet instance containing the elements present in
elements but not present in the current set. The value
null may be returned in place of an empty result set.IntSet or(IntSet a)
IntSet object containing all elements that are
present in the current set, the specified set a, or both.
This method is similar to addAll(IntSet), but returns a new
IntSet instance instead of modifying the current set.
a - The set to union with the current set. A null argument
is treated as though it were an empty set.IntSet instance containing the union of the current
set and a. The value null may be returned in place of an
empty result set.IntSet subtract(IntSet a)
IntSet object containing all elements that are
present in the current set but not present in the input set a.
The following expressions are equivalent for input non-null
IntSet instances x and y.
y.subtract(x)x.complement(y)a - The set to compare with the current set. A null
argument is treated as though it were an empty set.IntSet instance containing the elements present in
elements but not present in the current set. The value
null may be returned in place of an empty result set.int size()
boolean isNil()
true if this set contains no elements.true if the current set contains no elements; otherwise,
false.boolean equals(java.lang.Object obj)
equals in class java.lang.Objectint getSingleElement()
size() is 1;
otherwise, returns Token.INVALID_TYPE.size() is 1;
otherwise, returns Token.INVALID_TYPE.boolean contains(int el)
true if the set contains the specified element.el - The element to check for.true if the set contains el; otherwise false.void remove(int el)
el - the value to removejava.lang.IllegalStateException - if the current set is read-onlyjava.util.List<java.lang.Integer> toList()
java.lang.String toString()
toString in class java.lang.Object