|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.klomp.snark.BitField
public class BitField
Container of a byte array representing set and unset bits.
| Constructor Summary | |
|---|---|
BitField(byte[] bitfield,
int size)
Creates a new BitField that represents size bits
as set by the given byte array. |
|
BitField(int size)
Creates a new BitField that represents size unset bits. |
|
| Method Summary | |
|---|---|
boolean |
complete()
Return true if all bits are set. |
int |
count()
Return the number of set bits. |
boolean |
get(int bit)
Return true if the bit is set or false if it is not. |
byte[] |
getFieldBytes()
This returns the actual byte array used. |
void |
set(int bit)
Sets the given bit to true. |
int |
size()
Return the size of the BitField. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BitField(int size)
size unset bits.
public BitField(byte[] bitfield,
int size)
size bits
as set by the given byte array. This will make a copy of the array.
Extra bytes will be ignored.
ArrayOutOfBoundsException - if give byte array is not large
enough.| Method Detail |
|---|
public byte[] getFieldBytes()
public int size()
public void set(int bit)
IndexOutOfBoundsException - if bit is smaller then zero
bigger then size (inclusive).public boolean get(int bit)
IndexOutOfBoundsException - if bit is smaller then zero
bigger then size (inclusive).public int count()
public boolean complete()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||