public class BitVector extends BitVectorBase<BitVector> implements Serializable
bits, BITS_PER_UNIT, DEBUG, LOG_BITS_PER_UNIT, LOW_MASK, MASK
Constructor and Description |
---|
BitVector() |
BitVector(BitVector s)
Creates a copy of a Bit String
|
BitVector(int nbits)
Creates an empty string with the specified size.
|
Modifier and Type | Method and Description |
---|---|
void |
and(BitVector set)
Logically ANDs this bit set with the specified set of bits.
|
static BitVector |
and(BitVector b1,
BitVector b2)
Return a new bit string as the AND of two others.
|
void |
andNot(BitVector vector) |
static BitVector |
andNot(BitVector b1,
BitVector b2)
Return a new bit string as the AND of two others.
|
void |
clear(int bit)
Clears a bit.
|
boolean |
equals(Object obj)
Compares this object against the specified object.
|
boolean |
get(int bit)
Gets a bit.
|
boolean |
intersectionEmpty(BitVector other)
Check if the intersection of the two sets is empty
|
boolean |
isSubset(BitVector other) |
int |
length()
Calculates and returns the set's size in bits.
|
void |
not()
Logically NOT this bit string
|
static BitVector |
not(BitVector s)
Return the NOT of a bit string
|
void |
or(BitVector set)
Logically ORs this bit set with the specified set of bits.
|
static BitVector |
or(BitVector b1,
BitVector b2)
Return a new FixedSizeBitVector as the OR of two others
|
int |
orWithDelta(BitVector set)
Logically ORs this bit set with the specified set of bits.
|
boolean |
sameBits(BitVector B)
Compares this object against the specified object.
|
void |
set(int bit)
Sets a bit.
|
void |
setAll()
Sets all bits.
|
void |
xor(BitVector set)
Logically XORs this bit set with the specified set of bits.
|
static BitVector |
xor(BitVector b1,
BitVector b2)
Return a new FixedSizeBitVector as the XOR of two others
|
clearAll, clone, contains, copyBits, hashCode, isZero, max, nextSetBit, populationCount, subscript, toString
public BitVector()
public BitVector(int nbits)
nbits
- the size of the stringpublic BitVector(BitVector s)
s
- the string to copyIllegalArgumentException
- if s is nullpublic final void set(int bit)
set
in class BitVectorBase<BitVector>
bit
- the bit to be setpublic final void clear(int bit)
clear
in class BitVectorBase<BitVector>
bit
- the bit to be clearedpublic final boolean get(int bit)
get
in class BitVectorBase<BitVector>
bit
- the bit to be gottenpublic final void and(BitVector set)
and
in class BitVectorBase<BitVector>
set
- the bit set to be ANDed withpublic static BitVector and(BitVector b1, BitVector b2)
public final void or(BitVector set)
or
in class BitVectorBase<BitVector>
set
- the bit set to be ORed withpublic final int orWithDelta(BitVector set)
set
- IllegalArgumentException
- if set is nullpublic static BitVector or(BitVector b1, BitVector b2)
public static BitVector xor(BitVector b1, BitVector b2)
public final void xor(BitVector set)
xor
in class BitVectorBase<BitVector>
set
- the bit set to be XORed withIllegalArgumentException
- if set is nullpublic final boolean intersectionEmpty(BitVector other)
intersectionEmpty
in class BitVectorBase<BitVector>
other
- the set to check intersection withIllegalArgumentException
- if other is nullpublic final int length()
length
in class BitVectorBase<BitVector>
public final boolean sameBits(BitVector B)
sameBits
in class BitVectorBase<BitVector>
B
- the object to compare withpublic boolean isSubset(BitVector other)
isSubset
in class BitVectorBase<BitVector>
public void andNot(BitVector vector)
andNot
in class BitVectorBase<BitVector>
public boolean equals(Object obj)
public final void setAll()
public final void not()