Top Fields Constructors Methods
com.jogamp.common.util

public Class IntBitfield

extends Object
Class Inheritance

Deprecated

Use 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.

Field Summary

Modifier and TypeField and Description
private final int
private final long
private final int[]
private static final int
private static final long
public static final int
UNIT_SIZE

Unit size in bits, here 32 bits for one int unit.

Constructor Summary

AccessConstructor and Description
public
IntBitfield(final long bitCount)

public
IntBitfield(final int bitCount)

Method Summary

Modifier and TypeMethod and Description
public final long
capacity()

Return the capacity of this bit field, i.e. the number of bits stored int this field.

private final void
check(final long bitnum)

private final void
check(final int bitnum)

public final boolean
get(final long bitnum)

Return true if the bit at position bitnum is set, otherwise false.

public final boolean
get(final int bitnum)

Return true if the bit at position bitnum is set, otherwise false.

public static final int
getBitCount(final int n)

Deprecated Use Bitfield.Util#bitCount(int).
public long
getBitCount()

Returns the number of set bits within this bitfield.

public final boolean
put(final long bitnum, final boolean bit)

Set or clear the bit at position bitnum according to bit and return the previous value.

public final boolean
put(final int bitnum, final boolean bit)

Set or clear the bit at position bitnum according to bit and return the previous value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bitsCountIback to summary
private final int bitsCountI
bitsCountLback to summary
private final long bitsCountL
storageback to summary
private final int[] storage
UNIT_SHIFT_Iback to summary
private static final int UNIT_SHIFT_I
UNIT_SHIFT_Lback to summary
private static final long UNIT_SHIFT_L
UNIT_SIZEback to summary
public static final int UNIT_SIZE

Unit size in bits, here 32 bits for one int unit.

Constructor Detail

IntBitfieldback to summary
public IntBitfield(final long bitCount)
IntBitfieldback to summary
public IntBitfield(final int bitCount)

Method Detail

capacityback to summary
public final long capacity()

Return the capacity of this bit field, i.e. the number of bits stored int this field.

checkback to summary
private final void check(final long bitnum)
checkback to summary
private final void check(final int bitnum)
getback to summary
public final boolean get(final long bitnum)

Return true if the bit at position bitnum is set, otherwise false.

getback to summary
public final boolean get(final int bitnum)

Return true if the bit at position bitnum is set, otherwise false.

getBitCountback to summary
public static final int getBitCount(final int n)
getBitCountback to summary
public long getBitCount()

Returns the number of set bits within this bitfield.

Utilizes {#link getBitCount(int)}.

putback to summary
public final boolean put(final long bitnum, final boolean bit)

Set or clear the bit at position bitnum according to bit and return the previous value.

putback to summary
public final boolean put(final int bitnum, final boolean bit)

Set or clear the bit at position bitnum according to bit and return the previous value.