public class SparseIntSet extends Object implements IntSet
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
elements
The backing store of int arrays
|
protected int |
size
The number of entries in the backing store that are valid.
|
| Modifier | Constructor and Description |
|---|---|
|
SparseIntSet()
Subclasses should use this with extreme care.
|
protected |
SparseIntSet(int size) |
protected |
SparseIntSet(int[] backingArray)
Subclasses should use this with extreme care.
|
|
SparseIntSet(IntSet S) |
protected |
SparseIntSet(SparseIntSet S) |
| Modifier and Type | Method and Description |
|---|---|
static SparseIntSet |
add(SparseIntSet s,
int j) |
boolean |
contains(int x)
Does this set contain value x?
|
boolean |
containsAny(IntSet set) |
boolean |
containsAny(SparseIntSet set) |
static SparseIntSet |
diff(SparseIntSet A,
SparseIntSet B)
Compute the asymmetric difference of two sets, a \ b.
|
static int[] |
diffInternal(SparseIntSet A,
SparseIntSet B) |
int |
elementAt(int idx) |
void |
foreach(IntSetAction action)
Invoke an action on each element of the Set
|
void |
foreachExcluding(IntSet X,
IntSetAction action)
Invoke an action on each element of the Set, excluding elements of Set X
|
int |
getIndex(int x) |
IntSet |
intersection(IntSet that)
This implementation must not despoil the original value of "this"
|
IntIterator |
intIterator() |
boolean |
isEmpty() |
boolean |
isSubset(IntSet that) |
int |
max() |
static SparseIntSet |
pair(int i,
int j) |
static int[] |
parseIntArray(String str)
Reverse of toString(): "{2,3}" -> [2,3]
|
boolean |
sameValue(IntSet that) |
static SparseIntSet |
singleton(int i) |
int |
size() |
int[] |
toIntArray() |
String |
toString() |
IntSet |
union(IntSet that)
This implementation must not despoil the original value of "this"
|
protected int[] elements
protected int size
protected SparseIntSet(int size)
protected SparseIntSet(int[] backingArray)
public SparseIntSet()
protected SparseIntSet(SparseIntSet S)
public SparseIntSet(IntSet S) throws IllegalArgumentException
IllegalArgumentExceptionpublic final boolean contains(int x)
public final int getIndex(int x)
public final int size()
public final boolean isEmpty()
public final int elementAt(int idx)
throws NoSuchElementException
NoSuchElementExceptionpublic boolean sameValue(IntSet that) throws IllegalArgumentException, UnimplementedError
sameValue in interface IntSetthis has the same value as that.IllegalArgumentExceptionUnimplementedErrorpublic static SparseIntSet diff(SparseIntSet A, SparseIntSet B)
public static int[] diffInternal(SparseIntSet A, SparseIntSet B)
public static int[] parseIntArray(String str)
IllegalArgumentException - if str is nullpublic static SparseIntSet singleton(int i)
public static SparseIntSet pair(int i, int j)
public IntSet intersection(IntSet that)
IntSetintersection in interface IntSetpublic IntSet union(IntSet that)
IntSetpublic IntIterator intIterator()
intIterator in interface IntSetpublic final int max()
throws IllegalStateException
max in interface IntSetIllegalStateExceptionpublic void foreach(IntSetAction action)
IntSetpublic void foreachExcluding(IntSet X, IntSetAction action)
IntSetforeachExcluding in interface IntSetIntSet.foreach(com.ibm.wala.util.intset.IntSetAction)public static SparseIntSet add(SparseIntSet s, int j)
IllegalArgumentException - if s is nullpublic boolean isSubset(IntSet that)
public boolean containsAny(IntSet set)
containsAny in interface IntSetpublic boolean containsAny(SparseIntSet set) throws IllegalArgumentException
IllegalArgumentExceptionpublic int[] toIntArray()