public class BitString extends AbstractDataObject
Modifier and Type | Field and Description |
---|---|
protected java.util.BitSet |
bitSet
Set of bit values.
|
Constructor and Description |
---|
BitString()
Constructs a new BitString that has no bits set.
|
BitString(int nbits)
Constructs a new BitString that has no bits set,
initialised to accommodate the given number of bits.
|
Modifier and Type | Method and Description |
---|---|
BitString |
clear()
Clears all bits in this bit string.
|
BitString |
clear(int bitInteger)
Clears the bit for the given number to false.
|
BitString |
clone()
Constructs a copy of this.
|
static BitString |
copyOf(BitString from)
Creates a new object of this type, initialising its field values from those of the given object.
|
boolean |
equals(java.lang.Object obj)
Compares some other object to this one for equality by value (not reference).
|
boolean |
get(int bitInteger)
Gets whether the bit for the given number is set or not.
|
int |
hashCode()
Gets a hash code value for this object.
|
int |
length()
Returns the number of bits represented by this bit string.
|
int |
nextSetBit(int fromIndex)
Returns the index of the first bit that is set to true
that occurs on or after the specified starting index.
|
BitString |
set(int bitInteger)
Sets the bit for the given number to true.
|
java.lang.String |
toString()
Returns a string describing this set of bits,
using numbers for bits.
|
checkModify, isReadOnly, setReadOnly
public BitString()
public BitString(int nbits)
nbits
- initial number of bitspublic int length()
public boolean get(int bitInteger)
bitInteger
- the number of the bit to be gotpublic BitString set(int bitInteger)
bitInteger
- the number of the bit to be setpublic BitString clear()
public BitString clear(int bitInteger)
bitInteger
- the number of the bit to be clearedpublic int nextSetBit(int fromIndex)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- other objectobj
public int hashCode()
hashCode
in class java.lang.Object
public BitString clone()
clone
in interface DataObject
clone
in class AbstractDataObject