Package com.ibm.wala.util.intset
Class BitVectorIntSet
- java.lang.Object
-
- com.ibm.wala.util.intset.BitVectorIntSet
-
- All Implemented Interfaces:
IntSet
,MutableIntSet
,Serializable
public final class BitVectorIntSet extends Object implements MutableIntSet
ABitVector
implementation ofMutableIntSet
. Note that this is NOT a value with regard to hashCode and equals.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BitVectorIntSet()
BitVectorIntSet(BitVector v)
BitVectorIntSet(IntSet S)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(int i)
Add an integer value to this set.boolean
addAll(IntSet set)
Add all members of set to this.boolean
addAllInIntersection(IntSet other, IntSet filter)
void
addAllOblivious(IntSet set)
this version of add all will likely be faster if the client doesn't care about the change or the population count.void
clear()
remove all elements from this setboolean
contains(int i)
boolean
containsAll(BitVectorIntSet other)
boolean
containsAny(IntSet set)
void
copySet(IntSet set)
Set the value of this to be the same as the value of setvoid
foreach(IntSetAction action)
Invoke an action on each element of the Setvoid
foreachExcluding(IntSet X, IntSetAction action)
Invoke an action on each element of the Set, excluding elements of Set XBitVector
getBitVector()
BitVectorIntSet
intersection(IntSet that)
This implementation must not despoil the original value of "this"void
intersectWith(IntSet set)
Intersect this with another set.IntIterator
intIterator()
Use with extreme care; doesn't detect ConcurrentModificationExceptionsboolean
isEmpty()
boolean
isSubset(IntSet that)
SparseIntSet
makeSparseCopy()
int
max()
int
nextSetBit(int n)
boolean
remove(int i)
Remove an integer from this set.boolean
removeAll(BitVectorIntSet set)
boolean
sameValue(IntSet that)
int
size()
SparseIntSet
toSparseIntSet()
TODO: optimizeString
toString()
IntSet
union(IntSet that)
This implementation must not despoil the original value of "this"
-
-
-
Constructor Detail
-
BitVectorIntSet
public BitVectorIntSet()
-
BitVectorIntSet
public BitVectorIntSet(BitVector v)
-
BitVectorIntSet
public BitVectorIntSet(IntSet S) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:MutableIntSet
remove all elements from this set- Specified by:
clear
in interfaceMutableIntSet
-
copySet
public void copySet(IntSet set) throws IllegalArgumentException
Description copied from interface:MutableIntSet
Set the value of this to be the same as the value of set- Specified by:
copySet
in interfaceMutableIntSet
- Throws:
IllegalArgumentException
-
addAll
public boolean addAll(IntSet set)
Description copied from interface:MutableIntSet
Add all members of set to this.- Specified by:
addAll
in interfaceMutableIntSet
- Returns:
- true iff the value of this changes.
-
addAllOblivious
public void addAllOblivious(IntSet set) throws IllegalArgumentException
this version of add all will likely be faster if the client doesn't care about the change or the population count.- Parameters:
set
-- Throws:
IllegalArgumentException
- if set == null
-
add
public boolean add(int i)
Description copied from interface:MutableIntSet
Add an integer value to this set.- Specified by:
add
in interfaceMutableIntSet
- Parameters:
i
- integer to add- Returns:
- true iff the value of this changes.
-
remove
public boolean remove(int i)
Description copied from interface:MutableIntSet
Remove an integer from this set.- Specified by:
remove
in interfaceMutableIntSet
- Parameters:
i
- integer to remove- Returns:
- true iff the value of this changes.
-
intersectWith
public void intersectWith(IntSet set)
Description copied from interface:MutableIntSet
Intersect this with another set.- Specified by:
intersectWith
in interfaceMutableIntSet
-
intersection
public BitVectorIntSet intersection(IntSet that)
Description copied from interface:IntSet
This implementation must not despoil the original value of "this"- Specified by:
intersection
in interfaceIntSet
- Returns:
- a new IntSet which is the intersection of this and that
-
union
public IntSet union(IntSet that)
Description copied from interface:IntSet
This implementation must not despoil the original value of "this"
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
intIterator
public IntIterator intIterator()
Use with extreme care; doesn't detect ConcurrentModificationExceptions- Specified by:
intIterator
in interfaceIntSet
- Returns:
- a perhaps more efficient iterator
-
foreach
public void foreach(IntSetAction action)
Description copied from interface:IntSet
Invoke an action on each element of the Set
-
makeSparseCopy
public SparseIntSet makeSparseCopy()
-
foreachExcluding
public void foreachExcluding(IntSet X, IntSetAction action)
Description copied from interface:IntSet
Invoke an action on each element of the Set, excluding elements of Set X- Specified by:
foreachExcluding
in interfaceIntSet
-
contains
public boolean contains(int i)
-
nextSetBit
public int nextSetBit(int n)
- Returns:
- min j >= n s.t get(j)
-
sameValue
public boolean sameValue(IntSet that) throws IllegalArgumentException, UnimplementedError
- Specified by:
sameValue
in interfaceIntSet
- Returns:
- true iff
this
has the same value asthat
. - Throws:
IllegalArgumentException
UnimplementedError
-
isSubset
public boolean isSubset(IntSet that)
-
getBitVector
public BitVector getBitVector()
-
toSparseIntSet
public SparseIntSet toSparseIntSet()
TODO: optimize
-
removeAll
public boolean removeAll(BitVectorIntSet set)
- Parameters:
set
-- Throws:
IllegalArgumentException
- if set is null
-
containsAny
public boolean containsAny(IntSet set) throws IllegalArgumentException
- Specified by:
containsAny
in interfaceIntSet
- Returns:
- true iff this set contains integer i
- Throws:
IllegalArgumentException
-
addAllInIntersection
public boolean addAllInIntersection(IntSet other, IntSet filter) throws IllegalArgumentException
- Specified by:
addAllInIntersection
in interfaceMutableIntSet
- Throws:
IllegalArgumentException
-
containsAll
public boolean containsAll(BitVectorIntSet other)
-
-