Package com.ibm.wala.util.intset
Class OffsetBitVector
- All Implemented Interfaces:
Serializable
,Cloneable
- See Also:
-
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
ConstructorsConstructorDescriptionOffsetBitVector
(int offset, int nbits) Creates an empty string with the specified size.Creates a copy of a Bit String -
Method Summary
Modifier and TypeMethodDescriptionfinal void
and
(OffsetBitVector set) Logically ANDs this bit set with the specified set of bits.static OffsetBitVector
and
(OffsetBitVector b1, OffsetBitVector b2) Return a new bit string as the AND of two others.void
andNot
(OffsetBitVector set) static OffsetBitVector
andNot
(OffsetBitVector b1, OffsetBitVector b2) Return a new bit string as the AND of two others.final void
clear
(int bit) Clears a bit.final void
copyBits
(OffsetBitVector set) Copies the values of the bits in the specified set into this set.boolean
Compares this object against the specified object.final boolean
get
(int bit) Gets a bit.int
final boolean
Check if the intersection of the two sets is emptyboolean
isSubset
(OffsetBitVector other) final int
length()
Calculates and returns the set's size in bits.int
max()
int
nextSetBit
(int start) final void
not()
Logically NOT this bit stringstatic OffsetBitVector
Return the NOT of a bit stringfinal void
or
(OffsetBitVector set) Logically ORs this bit set with the specified set of bits.static OffsetBitVector
or
(OffsetBitVector b1, OffsetBitVector b2) Return a new FixedSizeBitVector as the OR of two othersfinal boolean
sameBits
(OffsetBitVector set) Compares this object against the specified object.final void
set
(int bit) Sets a bit.final void
setAll()
Sets all bits.toString()
final void
xor
(OffsetBitVector set) Logically XORs this bit set with the specified set of bits.Methods inherited from class com.ibm.wala.util.intset.BitVectorBase
clearAll, clone, contains, copyBits, hashCode, isZero, populationCount, subscript
-
Constructor Details
-
OffsetBitVector
public OffsetBitVector() -
OffsetBitVector
public OffsetBitVector(int offset, int nbits) Creates an empty string with the specified size.- Parameters:
nbits
- the size of the string
-
OffsetBitVector
Creates a copy of a Bit String- Parameters:
s
- the string to copy- Throws:
IllegalArgumentException
- if s is null
-
-
Method Details
-
toString
- Overrides:
toString
in classBitVectorBase<OffsetBitVector>
-
getOffset
public int getOffset() -
set
public final void set(int bit) Sets a bit.- Specified by:
set
in classBitVectorBase<OffsetBitVector>
- Parameters:
bit
- the bit to be set
-
clear
public final void clear(int bit) Clears a bit.- Specified by:
clear
in classBitVectorBase<OffsetBitVector>
- Parameters:
bit
- the bit to be cleared
-
get
public final boolean get(int bit) Gets a bit.- Specified by:
get
in classBitVectorBase<OffsetBitVector>
- Parameters:
bit
- the bit to be gotten
-
nextSetBit
public int nextSetBit(int start) - Overrides:
nextSetBit
in classBitVectorBase<OffsetBitVector>
- Returns:
- min j >= start s.t get(j)
-
not
public final void not()Logically NOT this bit string -
max
public int max()- Overrides:
max
in classBitVectorBase<OffsetBitVector>
-
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<OffsetBitVector>
-
setAll
public final void setAll()Sets all bits. -
equals
Compares this object against the specified object. -
intersectionEmpty
Check if the intersection of the two sets is empty- Specified by:
intersectionEmpty
in classBitVectorBase<OffsetBitVector>
- Parameters:
set
- the set to check intersection with- Throws:
IllegalArgumentException
- if set == null
-
sameBits
Compares this object against the specified object.- Specified by:
sameBits
in classBitVectorBase<OffsetBitVector>
- Parameters:
set
- the object to compare with- Returns:
- true if the objects are the same; false otherwise.
- Throws:
IllegalArgumentException
- if set == null
-
isSubset
- Specified by:
isSubset
in classBitVectorBase<OffsetBitVector>
- Throws:
IllegalArgumentException
-
copyBits
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
-
and
Logically ANDs this bit set with the specified set of bits.- Specified by:
and
in classBitVectorBase<OffsetBitVector>
- Parameters:
set
- the bit set to be ANDed with- Throws:
IllegalArgumentException
- if set == null
-
or
Logically ORs this bit set with the specified set of bits.- Specified by:
or
in classBitVectorBase<OffsetBitVector>
- Parameters:
set
- the bit set to be ORed with- Throws:
IllegalArgumentException
- if set == null
-
xor
Logically XORs this bit set with the specified set of bits.- Specified by:
xor
in classBitVectorBase<OffsetBitVector>
- Parameters:
set
- the bit set to be XORed with- Throws:
IllegalArgumentException
- if set == null
-
andNot
- Specified by:
andNot
in classBitVectorBase<OffsetBitVector>
- Throws:
IllegalArgumentException
-
not
Return the NOT of a bit string -
and
public static OffsetBitVector and(OffsetBitVector b1, OffsetBitVector b2) throws IllegalArgumentException Return a new bit string as the AND of two others.- Throws:
IllegalArgumentException
- if b2 == null
-
or
public static OffsetBitVector or(OffsetBitVector b1, OffsetBitVector b2) throws IllegalArgumentException Return a new FixedSizeBitVector as the OR of two others- Throws:
IllegalArgumentException
- if b2 == null
-
andNot
Return a new bit string as the AND of two others.
-