Bitfield
implementations via Bitfield.Factory.create(int)
.
Simple bitfield holder class using an int[] storage.
IntBitfield allows convenient access of a wide field of transient bits using efficient storage in O(1).
It can be used e.g. to map key-codes to pressed-state etc.
public class IntBitfield extends Object
Modifier and Type | Field and Description |
---|---|
static int |
UNIT_SIZE
Deprecated.
Unit size in bits, here 32 bits for one int unit.
|
Constructor and Description |
---|
IntBitfield(int bitCount)
Deprecated.
|
IntBitfield(long bitCount)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
long |
capacity()
Deprecated.
Return the capacity of this bit field, i.e.
|
boolean |
get(int bitnum)
Deprecated.
Return
true if the bit at position bitnum is set, otherwise false . |
boolean |
get(long bitnum)
Deprecated.
Return
true if the bit at position bitnum is set, otherwise false . |
long |
getBitCount()
Deprecated.
Returns the number of set bits within this bitfield.
|
static int |
getBitCount(int n)
Deprecated.
|
boolean |
put(int bitnum,
boolean bit)
Deprecated.
Set or clear the bit at position
bitnum according to bit
and return the previous value. |
boolean |
put(long bitnum,
boolean bit)
Deprecated.
Set or clear the bit at position
bitnum according to bit
and return the previous value. |
public static final int UNIT_SIZE
public IntBitfield(long bitCount)
bitCount
- public IntBitfield(int bitCount)
bitCount
- public final long capacity()
public final boolean get(long bitnum)
true
if the bit at position bitnum
is set, otherwise false
.public final boolean get(int bitnum)
true
if the bit at position bitnum
is set, otherwise false
.public final boolean put(long bitnum, boolean bit)
bitnum
according to bit
and return the previous value.public final boolean put(int bitnum, boolean bit)
bitnum
according to bit
and return the previous value.public static final int getBitCount(int n)
Bitfield.Util.bitCount(int)
.public long getBitCount()
Utilizes {#link getBitCount(int)
}.