public final class FixedSizeBitVector extends Object implements Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
Constructor and Description |
---|
FixedSizeBitVector(FixedSizeBitVector s)
Creates a copy of a Bit String
|
FixedSizeBitVector(int nbits)
Creates an empty string with the specified size.
|
Modifier and Type | Method and Description |
---|---|
void |
and(FixedSizeBitVector set)
Logically ANDs this bit set with the specified set of bits.
|
static FixedSizeBitVector |
and(FixedSizeBitVector b1,
FixedSizeBitVector b2)
Return a new bit string as the AND of two others.
|
void |
clear(int bit)
Clears a bit.
|
void |
clearAll()
Clears all bits.
|
Object |
clone()
Clones the FixedSizeBitVector.
|
void |
copyBits(FixedSizeBitVector set)
Copies the values of the bits in the specified set into this set.
|
boolean |
equals(Object obj)
Compares this object against the specified object.
|
boolean |
get(int bit)
Gets a bit.
|
int |
hashCode()
Gets the hashcode.
|
boolean |
intersectionEmpty(FixedSizeBitVector other)
Check if the intersection of the two sets is empty
|
boolean |
isZero() |
int |
length()
Calculates and returns the set's size in bits.
|
void |
not()
Logically NOT this bit string
|
static FixedSizeBitVector |
not(FixedSizeBitVector s)
Return the NOT of a bit string
|
void |
or(FixedSizeBitVector set)
Logically ORs this bit set with the specified set of bits.
|
static FixedSizeBitVector |
or(FixedSizeBitVector b1,
FixedSizeBitVector b2)
Return a new FixedSizeBitVector as the OR of two others
|
int |
populationCount()
How many bits are set?
|
void |
set(int bit)
Sets a bit.
|
void |
setAll()
Sets all bits.
|
String |
toString()
Converts the FixedSizeBitVector to a String.
|
void |
xor(FixedSizeBitVector set)
Logically XORs this bit set with the specified set of bits.
|
public static final long serialVersionUID
public FixedSizeBitVector(int nbits)
nbits
- the size of the stringpublic FixedSizeBitVector(FixedSizeBitVector s)
s
- the string to copyIllegalArgumentException
- if s is nullpublic void setAll()
public void set(int bit)
bit
- the bit to be setpublic void clearAll()
public void clear(int bit)
bit
- the bit to be clearedpublic boolean get(int bit)
bit
- the bit to be gottenpublic void not()
public static FixedSizeBitVector not(FixedSizeBitVector s)
public void and(FixedSizeBitVector set)
set
- the bit set to be ANDed withpublic static FixedSizeBitVector and(FixedSizeBitVector b1, FixedSizeBitVector b2)
public void or(FixedSizeBitVector set) throws IllegalArgumentException
set
- the bit set to be ORed withIllegalArgumentException
- if set == nullpublic static FixedSizeBitVector or(FixedSizeBitVector b1, FixedSizeBitVector b2) throws IllegalArgumentException
IllegalArgumentException
- if b2 == nullpublic void xor(FixedSizeBitVector set)
set
- the bit set to be XORed withIllegalArgumentException
- if set is nullpublic boolean intersectionEmpty(FixedSizeBitVector other)
other
- the set to check intersection withpublic void copyBits(FixedSizeBitVector set)
set
- the bit set to copy the bits fromIllegalArgumentException
- if set is nullpublic int populationCount()
public int length()
public boolean equals(Object obj)
public boolean isZero()