Package com.ibm.wala.util.intset
Class FixedSizeBitVector
- java.lang.Object
-
- com.ibm.wala.util.intset.FixedSizeBitVector
-
- All Implemented Interfaces:
Serializable,Cloneable
public final class FixedSizeBitVector extends Object implements Cloneable, Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description FixedSizeBitVector(int nbits)Creates an empty string with the specified size.FixedSizeBitVector(FixedSizeBitVector s)Creates a copy of a Bit String
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidand(FixedSizeBitVector set)Logically ANDs this bit set with the specified set of bits.static FixedSizeBitVectorand(FixedSizeBitVector b1, FixedSizeBitVector b2)Return a new bit string as the AND of two others.voidclear(int bit)Clears a bit.voidclearAll()Clears all bits.Objectclone()Clones the FixedSizeBitVector.voidcopyBits(FixedSizeBitVector set)Copies the values of the bits in the specified set into this set.booleanequals(Object obj)Compares this object against the specified object.booleanget(int bit)Gets a bit.inthashCode()Gets the hashcode.booleanintersectionEmpty(FixedSizeBitVector other)Check if the intersection of the two sets is emptybooleanisZero()intlength()Calculates and returns the set's size in bits.voidnot()Logically NOT this bit stringstatic FixedSizeBitVectornot(FixedSizeBitVector s)Return the NOT of a bit stringvoidor(FixedSizeBitVector set)Logically ORs this bit set with the specified set of bits.static FixedSizeBitVectoror(FixedSizeBitVector b1, FixedSizeBitVector b2)Return a new FixedSizeBitVector as the OR of two othersintpopulationCount()How many bits are set?voidset(int bit)Sets a bit.voidsetAll()Sets all bits.StringtoString()Converts the FixedSizeBitVector to a String.voidxor(FixedSizeBitVector set)Logically XORs this bit set with the specified set of bits.
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FixedSizeBitVector
public FixedSizeBitVector(int nbits)
Creates an empty string with the specified size.- Parameters:
nbits- the size of the string
-
FixedSizeBitVector
public FixedSizeBitVector(FixedSizeBitVector s)
Creates a copy of a Bit String- Parameters:
s- the string to copy- Throws:
IllegalArgumentException- if s is null
-
-
Method Detail
-
setAll
public void setAll()
Sets all bits.
-
set
public void set(int bit)
Sets a bit.- Parameters:
bit- the bit to be set
-
clearAll
public void clearAll()
Clears all bits.
-
clear
public void clear(int bit)
Clears a bit.- Parameters:
bit- the bit to be cleared
-
get
public boolean get(int bit)
Gets a bit.- Parameters:
bit- the bit to be gotten
-
not
public void not()
Logically NOT this bit string
-
not
public static FixedSizeBitVector not(FixedSizeBitVector s)
Return the NOT of a bit string
-
and
public void and(FixedSizeBitVector set)
Logically ANDs this bit set with the specified set of bits.- Parameters:
set- the bit set to be ANDed with
-
and
public static FixedSizeBitVector and(FixedSizeBitVector b1, FixedSizeBitVector b2)
Return a new bit string as the AND of two others.
-
or
public void or(FixedSizeBitVector set) throws IllegalArgumentException
Logically ORs this bit set with the specified set of bits.- Parameters:
set- the bit set to be ORed with- Throws:
IllegalArgumentException- if set == null
-
or
public static FixedSizeBitVector or(FixedSizeBitVector b1, FixedSizeBitVector b2) throws IllegalArgumentException
Return a new FixedSizeBitVector as the OR of two others- Throws:
IllegalArgumentException- if b2 == null
-
xor
public void xor(FixedSizeBitVector set)
Logically XORs this bit set with the specified set of bits.- Parameters:
set- the bit set to be XORed with- Throws:
IllegalArgumentException- if set is null
-
intersectionEmpty
public boolean intersectionEmpty(FixedSizeBitVector other)
Check if the intersection of the two sets is empty- Parameters:
other- the set to check intersection with
-
copyBits
public void copyBits(FixedSizeBitVector set)
Copies the values of the bits in the specified set into this set.- Parameters:
set- the bit set to copy the bits from- Throws:
IllegalArgumentException- if set is null
-
populationCount
public int populationCount()
How many bits are set?
-
length
public int length()
Calculates and returns the set's size in bits. The maximum element in the set is the size - 1st element.
-
equals
public boolean equals(Object obj)
Compares this object against the specified object.
-
isZero
public boolean isZero()
-
-