com.ibm.wala.util.intset
Class OffsetBitVector

java.lang.Object
  extended by com.ibm.wala.util.intset.BitVectorBase<OffsetBitVector>
      extended by com.ibm.wala.util.intset.OffsetBitVector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class OffsetBitVector
extends BitVectorBase<OffsetBitVector>

See Also:
Serialized Form

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
OffsetBitVector()
           
OffsetBitVector(int offset, int nbits)
          Creates an empty string with the specified size.
OffsetBitVector(OffsetBitVector s)
          Creates a copy of a Bit String
 
Method Summary
 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.
 void clear(int bit)
          Clears a bit.
 void copyBits(OffsetBitVector set)
          Copies the values of the bits in the specified set into this set.
 boolean equals(java.lang.Object obj)
          Compares this object against the specified object.
 boolean get(int bit)
          Gets a bit.
 int getOffset()
           
 boolean intersectionEmpty(OffsetBitVector set)
          Check if the intersection of the two sets is empty
 boolean isSubset(OffsetBitVector other)
           
 int length()
          Calculates and returns the set's size in bits.
 int max()
           
 int nextSetBit(int start)
           
 void not()
          Logically NOT this bit string
static OffsetBitVector not(OffsetBitVector s)
          Return the NOT of a bit string
 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 others
 boolean sameBits(OffsetBitVector set)
          Compares this object against the specified object.
 void set(int bit)
          Sets a bit.
 void setAll()
          Sets all bits.
 java.lang.String toString()
          Converts the FixedSizeBitVector to a String.
 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
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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

public OffsetBitVector(OffsetBitVector s)
Creates a copy of a Bit String

Parameters:
s - the string to copy
Throws:
java.lang.IllegalArgumentException - if s is null
Method Detail

toString

public java.lang.String toString()
Description copied from class: BitVectorBase
Converts the FixedSizeBitVector to a String.

Overrides:
toString in class BitVectorBase<OffsetBitVector>

getOffset

public int getOffset()

set

public final void set(int bit)
Sets a bit.

Specified by:
set in class BitVectorBase<OffsetBitVector>
Parameters:
bit - the bit to be set

clear

public final void clear(int bit)
Clears a bit.

Specified by:
clear in class BitVectorBase<OffsetBitVector>
Parameters:
bit - the bit to be cleared

get

public final boolean get(int bit)
Gets a bit.

Specified by:
get in class BitVectorBase<OffsetBitVector>
Parameters:
bit - the bit to be gotten

nextSetBit

public int nextSetBit(int start)
Overrides:
nextSetBit in class BitVectorBase<OffsetBitVector>
Parameters:
start -
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 class BitVectorBase<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 class BitVectorBase<OffsetBitVector>

setAll

public final void setAll()
Sets all bits.


equals

public boolean equals(java.lang.Object obj)
Compares this object against the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with
Returns:
true if the objects are the same; false otherwise.

intersectionEmpty

public final boolean intersectionEmpty(OffsetBitVector set)
Check if the intersection of the two sets is empty

Specified by:
intersectionEmpty in class BitVectorBase<OffsetBitVector>
Parameters:
other - the set to check intersection with

sameBits

public final boolean sameBits(OffsetBitVector set)
Compares this object against the specified object.

Specified by:
sameBits in class BitVectorBase<OffsetBitVector>
Parameters:
set - the object to compare with
Returns:
true if the objects are the same; false otherwise.

isSubset

public boolean isSubset(OffsetBitVector other)
Specified by:
isSubset in class BitVectorBase<OffsetBitVector>

copyBits

public final void copyBits(OffsetBitVector 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:
java.lang.IllegalArgumentException - if set is null

and

public final void and(OffsetBitVector set)
Logically ANDs this bit set with the specified set of bits.

Specified by:
and in class BitVectorBase<OffsetBitVector>
Parameters:
set - the bit set to be ANDed with

or

public final void or(OffsetBitVector set)
Logically ORs this bit set with the specified set of bits.

Specified by:
or in class BitVectorBase<OffsetBitVector>
Parameters:
set - the bit set to be ORed with

xor

public final void xor(OffsetBitVector set)
Logically XORs this bit set with the specified set of bits.

Specified by:
xor in class BitVectorBase<OffsetBitVector>
Parameters:
set - the bit set to be XORed with

andNot

public void andNot(OffsetBitVector set)
Specified by:
andNot in class BitVectorBase<OffsetBitVector>
Parameters:
vector -

not

public static OffsetBitVector not(OffsetBitVector s)
Return the NOT of a bit string


and

public static OffsetBitVector and(OffsetBitVector b1,
                                  OffsetBitVector b2)
Return a new bit string as the AND of two others.


or

public static OffsetBitVector or(OffsetBitVector b1,
                                 OffsetBitVector b2)
Return a new FixedSizeBitVector as the OR of two others


andNot

public static OffsetBitVector andNot(OffsetBitVector b1,
                                     OffsetBitVector b2)
Return a new bit string as the AND of two others.