Package com.ibm.wala.util.intset
Class BitSet<T>
- java.lang.Object
-
- com.ibm.wala.util.intset.BitSet<T>
-
public final class BitSet<T> extends Object
A bit set is a set of elements, each of which corresponds to a unique integer from [0,MAX].
-
-
Constructor Summary
Constructors Constructor Description BitSet(OrdinalSetMapping<T> map)
Constructor: create an empty set corresponding to a given mapping
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T o)
Add an object to this bit set.void
addAll(BitSet<?> B)
Add all elements in bitset B to this bit setvoid
addAll(BitVector B)
Add all bits in BitVector B to this bit setvoid
clear(T o)
Remove an object from this bit set.void
clearAll()
Set all the bits to 0.boolean
contains(T o)
Does this set contain a certain object?void
copyBits(BitSet<T> other)
Method copy.static <T> BitSet<T>
createBitSet(BitSet<T> B)
void
difference(BitSet<T> other)
Perform the difference of two bit setsvoid
intersect(BitSet<?> other)
Perform intersection of two bitsetsboolean
isEmpty()
Iterator<T>
iterator()
Not very efficient.int
length()
boolean
sameBits(BitSet<?> other)
Does this object hold the same bits as other?void
setAll()
Set all the bits to 1.int
size()
String
toString()
-
-
-
Constructor Detail
-
BitSet
public BitSet(OrdinalSetMapping<T> map)
Constructor: create an empty set corresponding to a given mapping- Throws:
IllegalArgumentException
- if map is null
-
-
Method Detail
-
addAll
public void addAll(BitSet<?> B)
Add all elements in bitset B to this bit set- Throws:
IllegalArgumentException
- if B is null
-
addAll
public void addAll(BitVector B)
Add all bits in BitVector B to this bit set
-
add
public void add(T o)
Add an object to this bit set.
-
clear
public void clear(T o)
Remove an object from this bit set.- Parameters:
o
- the object to remove
-
contains
public boolean contains(T o)
Does this set contain a certain object?
-
toString
public String toString()
-
copyBits
public void copyBits(BitSet<T> other)
Method copy. Copies the bits in the bit vector, but only assigns the object map. No need to create a new object/bit bijection object.- Throws:
IllegalArgumentException
- if other is null
-
sameBits
public boolean sameBits(BitSet<?> other)
Does this object hold the same bits as other?- Throws:
IllegalArgumentException
- if other is null
-
size
public int size()
-
length
public int length()
-
clearAll
public void clearAll()
Set all the bits to 0.
-
setAll
public void setAll()
Set all the bits to 1.
-
intersect
public void intersect(BitSet<?> other)
Perform intersection of two bitsets- Parameters:
other
- the other bitset in the operation- Throws:
IllegalArgumentException
- if other is null
-
difference
public void difference(BitSet<T> other)
Perform the difference of two bit sets- Parameters:
other
- the other bitset in the operation- Throws:
IllegalArgumentException
- if other is null
-
isEmpty
public boolean isEmpty()
-
-