Class BitVector
-
Field Summary
Fields inherited from class com.ibm.wala.util.intset.BitVectorBase
bits, BITS_PER_UNIT, DEBUG, LOG_BITS_PER_UNIT, LOW_MASK, MASK
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Logically ANDs this bit set with the specified set of bits.static BitVector
Return a new bit string as the AND of two others.void
static BitVector
Return a new bit string as the AND of two others.final void
clear
(int bit) Clears a bit.boolean
Compares this object against the specified object.final boolean
get
(int bit) Gets a bit.final boolean
intersectionEmpty
(BitVector other) Check if the intersection of the two sets is emptyboolean
final int
length()
Calculates and returns the set's size in bits.final void
not()
Logically NOT this bit stringstatic BitVector
Return the NOT of a bit stringfinal void
Logically ORs this bit set with the specified set of bits.static BitVector
Return a new FixedSizeBitVector as the OR of two othersfinal int
orWithDelta
(BitVector set) Logically ORs this bit set with the specified set of bits.final boolean
Compares this object against the specified object.final void
set
(int bit) Sets a bit.final void
setAll()
Sets all bits.final void
Logically XORs this bit set with the specified set of bits.static BitVector
Return a new FixedSizeBitVector as the XOR of two othersMethods inherited from class com.ibm.wala.util.intset.BitVectorBase
clearAll, clone, contains, copyBits, hashCode, isZero, max, nextSetBit, populationCount, subscript, toString
-
Constructor Details
-
BitVector
public BitVector() -
BitVector
public BitVector(int nbits) Creates an empty string with the specified size.- Parameters:
nbits
- the size of the string
-
BitVector
Creates a copy of a Bit String- Parameters:
s
- the string to copy- Throws:
IllegalArgumentException
- if s is null
-
-
Method Details
-
set
public final void set(int bit) Sets a bit.- Specified by:
set
in classBitVectorBase<BitVector>
- Parameters:
bit
- the bit to be set
-
clear
public final void clear(int bit) Clears a bit.- Specified by:
clear
in classBitVectorBase<BitVector>
- Parameters:
bit
- the bit to be cleared
-
get
public final boolean get(int bit) Gets a bit.- Specified by:
get
in classBitVectorBase<BitVector>
- Parameters:
bit
- the bit to be gotten
-
not
-
and
Logically ANDs this bit set with the specified set of bits.- Specified by:
and
in classBitVectorBase<BitVector>
- Parameters:
set
- the bit set to be ANDed with
-
and
-
or
Logically ORs this bit set with the specified set of bits.- Specified by:
or
in classBitVectorBase<BitVector>
- Parameters:
set
- the bit set to be ORed with
-
orWithDelta
Logically ORs this bit set with the specified set of bits. This is performance-critical, and so, a little ugly in an attempt to help out the compiler.- Returns:
- the number of bits added to this.
- Throws:
IllegalArgumentException
- if set is null
-
or
-
xor
-
xor
Logically XORs this bit set with the specified set of bits.- Specified by:
xor
in classBitVectorBase<BitVector>
- Parameters:
set
- the bit set to be XORed with- Throws:
IllegalArgumentException
- if set is null
-
intersectionEmpty
Check if the intersection of the two sets is empty- Specified by:
intersectionEmpty
in classBitVectorBase<BitVector>
- Parameters:
other
- the set to check intersection with- Throws:
IllegalArgumentException
- if other is null
-
length
public final int length()Calculates and returns the set's size in bits. The maximum element in the set is the size - 1st element.- Specified by:
length
in classBitVectorBase<BitVector>
-
sameBits
Compares this object against the specified object.- Specified by:
sameBits
in classBitVectorBase<BitVector>
- Parameters:
B
- the object to compare with- Returns:
- true if the objects are the same; false otherwise.
-
isSubset
- Specified by:
isSubset
in classBitVectorBase<BitVector>
- Returns:
- true iff this is a subset of other
-
andNot
- Specified by:
andNot
in classBitVectorBase<BitVector>
-
equals
-
setAll
public final void setAll()Sets all bits. -
not
public final void not()Logically NOT this bit string -
andNot
-