Class SparseLongSet
java.lang.Object
com.ibm.wala.util.intset.SparseLongSet
- All Implemented Interfaces:
LongSet
- Direct Known Subclasses:
MutableSparseLongSet
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionSubclasses should use this with extreme care.protectedSparseLongSet(int size) //////////////////////////////////////////////////////////////////////////protectedSparseLongSet(long[] backingArray) Subclasses should use this with extreme care.protected -
Method Summary
Modifier and TypeMethodDescriptionstatic SparseLongSetadd(SparseLongSet s, int j) final booleancontains(long x) Does this set contain value x?booleancontainsAny(LongSet set) booleancontainsAny(SparseLongSet set) static SparseLongSetdiff(SparseLongSet A, SparseLongSet B) Compute the asymmetric difference of two sets, a \ b.final longelementAt(int idx) voidforeach(LongSetAction action) Invoke an action on each element of the SetvoidforeachExcluding(LongSet X, LongSetAction action) Invoke an action on each element of the Set, excluding elements of Set Xfinal intgetIndex(long x) @Nullable LongSetintersection(LongSet that) This implementation must not despoil the original value of "this"final booleanisEmpty()booleanfinal longmax()static SparseLongSetpair(long i, long j) static long[]parseLongArray(String str) Reverse of toString(): "{2,3}" -> [2,3]booleanstatic SparseLongSetsingleton(int i) final intsize()toString()
-
Field Details
-
elements
protected long[] elementsThe backing store of int arrays -
size
protected int sizeThe number of entries in the backing store that are valid.
-
-
Constructor Details
-
SparseLongSet
protected SparseLongSet(int size) ////////////////////////////////////////////////////////////////////////// -
SparseLongSet
protected SparseLongSet(long[] backingArray) Subclasses should use this with extreme care. Do not allow the backing array to escape elsewhere. -
SparseLongSet
@NullUnmarked public SparseLongSet()Subclasses should use this with extreme care. -
SparseLongSet
-
SparseLongSet
- Throws:
IllegalArgumentException
-
-
Method Details
-
contains
-
getIndex
public final int getIndex(long x) - Returns:
- index i s.t. elements[i] == x, or -1 if not found.
-
size
-
isEmpty
-
elementAt
- Throws:
NoSuchElementException
-
sameValue
- Specified by:
sameValuein interfaceLongSet- Returns:
- true iff
thishas the same value asthat. - Throws:
IllegalArgumentExceptionUnimplementedError
-
diff
Compute the asymmetric difference of two sets, a \ b.- Throws:
IllegalArgumentException- if A is null
-
toString
-
parseLongArray
public static long[] parseLongArray(String str) throws NumberFormatException, IllegalArgumentException Reverse of toString(): "{2,3}" -> [2,3]- Throws:
IllegalArgumentException- if str is nullNumberFormatException
-
singleton
-
pair
-
intersection
public @Nullable LongSet intersection(LongSet that) throws IllegalArgumentException, UnimplementedError Description copied from interface:LongSetThis implementation must not despoil the original value of "this"- Specified by:
intersectionin interfaceLongSet- Returns:
- a new IntSet which is the intersection of this and that
- Throws:
IllegalArgumentExceptionUnimplementedError- See Also:
-
longIterator
- Specified by:
longIteratorin interfaceLongSet- Returns:
- a perhaps more efficient iterator
- See Also:
-
foreach
Description copied from interface:LongSetInvoke an action on each element of the Set -
foreachExcluding
Description copied from interface:LongSetInvoke an action on each element of the Set, excluding elements of Set X- Specified by:
foreachExcludingin interfaceLongSet
-
max
- Specified by:
maxin interfaceLongSet- Returns:
- the largest element in the set
- Throws:
IllegalStateException
-
add
- Returns:
- a new sparse int set which adds j to s
-
isSubset
- Specified by:
isSubsetin interfaceLongSet- Returns:
- true iff
thisis a subset ofthat. - Throws:
IllegalArgumentExceptionUnimplementedError- See Also:
-
containsAny
- Specified by:
containsAnyin interfaceLongSet- Returns:
- true iff this set contains integer i
- See Also:
-
containsAny
- Throws:
IllegalArgumentException
-