Top Description Fields Constructors Methods
jogamp.common.util

public Class Int32ArrayBitfield

extends Object
implements Bitfield
Class Inheritance
All Implemented Interfaces
com.jogamp.common.util.Bitfield
Imports
com.jogamp.common.util.Bitfield

Simple bitfield interface for efficient storage access in O(1).

Implementation uses a 32bit integer array for storage.

Field Summary

Modifier and TypeField and Description
private final int
private final int[]
private static final int

Constructor Summary

AccessConstructor and Description
public
Int32ArrayBitfield(final int storageBitSize)

Method Summary

Modifier and TypeMethod and Description
public int
bitCount()

Implements com.jogamp.common.util.Bitfield.bitCount.

Returns the number of one bits within this bitfield.
private static final void
check(final int size, final int bitnum)

public final void
clear(final int
bit number, restricted to [0..size()-1].
bitnum
)

Implements com.jogamp.common.util.Bitfield.clear.

Clear the bit at position bitnum according to bit.
public final void
clearField(final boolean bit)

Implements com.jogamp.common.util.Bitfield.clearField.

Set all bits of this bitfield to the given value bit.
public final boolean
copy(final int
source bit number, restricted to [0..size()-1].
srcBitnum
,
final int
destination bit number, restricted to [0..size()-1].
dstBitnum
)

Implements com.jogamp.common.util.Bitfield.copy.

Copies the bit at position srcBitnum to position dstBitnum and returning true if the bit is set, otherwise false.
public final int
copy32(final int
source bit number, restricted to [0..size()-1].
srcBitnum
,
final int
destination bit number, restricted to [0..size()-1].
dstBitnum
,
final int length)

Implements com.jogamp.common.util.Bitfield.copy32.

Copies length bits at position srcLowBitnum to position dstLowBitnum and returning the bits.
public final boolean
get(final int
bit number, restricted to [0..size()-1].
bitnum
)

Implements com.jogamp.common.util.Bitfield.get.

Return true if the bit at position bitnum is set, otherwise false.
public final int
get32(final int
storage bit position of the lowest bit, restricted to [0..size()-length].
lowBitnum
,
final int
number of bits to read, constrained to [0..32].
length
)

Implements com.jogamp.common.util.Bitfield.get32.

Returns length bits from this storage, starting with the lowest bit from the storage position lowBitnum.
public final boolean
put(final int
bit number, restricted to [0..size()-1].
bitnum
,
final boolean bit)

Implements com.jogamp.common.util.Bitfield.put.

Set or clear the bit at position bitnum according to bit and return the previous value.
public final void
put32(final int
storage bit position of the lowest bit, restricted to [0..size()-length].
lowBitnum
,
final int
number of bits to write, constrained to [0..32].
length
,
final int
the actual bits to be put into this storage
data
)

Implements com.jogamp.common.util.Bitfield.put32.

Puts length bits of given data into this storage, starting w/ the lowest bit to the storage position lowBitnum.
public final void
set(final int
bit number, restricted to [0..size()-1].
bitnum
)

Implements com.jogamp.common.util.Bitfield.set.

Set the bit at position bitnum according to bit.
public int
size()

Implements com.jogamp.common.util.Bitfield.size.

Returns the storage size in bit units, e.g. 32 bit for implementations using one int field.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bitSizeback to summary
private final int bitSize
storageback to summary
private final int[] storage
UNIT_SHIFTback to summary
private static final int UNIT_SHIFT

Constructor Detail

Int32ArrayBitfieldback to summary
public Int32ArrayBitfield(final int storageBitSize)

Method Detail

bitCountback to summary
public int bitCount()

Implements com.jogamp.common.util.Bitfield.bitCount.

Doc from com.jogamp.common.util.Bitfield.bitCount.

Returns the number of one bits within this bitfield.

Utilizes {#link Bitfield.Util#bitCount(int)}.

Annotations
@Override
checkback to summary
private static final void check(final int size, final int bitnum) throws IndexOutOfBoundsException
clearback to summary
public final void clear(final int bitnum) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.Bitfield.clear.

Doc from com.jogamp.common.util.Bitfield.clear.

Clear the bit at position bitnum according to bit.

Parameters
bitnum:int

bit number, restricted to [0..size()-1].

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if bitnum is out of bounds
clearFieldback to summary
public final void clearField(final boolean bit)

Implements com.jogamp.common.util.Bitfield.clearField.

Doc from com.jogamp.common.util.Bitfield.clearField.

Set all bits of this bitfield to the given value bit.

Annotations
@Override
copyback to summary
public final boolean copy(final int srcBitnum, final int dstBitnum) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.Bitfield.copy.

Doc from com.jogamp.common.util.Bitfield.copy.

Copies the bit at position srcBitnum to position dstBitnum and returning true if the bit is set, otherwise false.

Parameters
srcBitnum:int

source bit number, restricted to [0..size()-1].

dstBitnum:int

destination bit number, restricted to [0..size()-1].

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if bitnum is out of bounds
copy32back to summary
public final int copy32(final int srcBitnum, final int dstBitnum, final int length) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.Bitfield.copy32.

Doc from com.jogamp.common.util.Bitfield.copy32.

Copies length bits at position srcLowBitnum to position dstLowBitnum and returning the bits.

Implementation shall operate as if invoking get32(int, int) and then put32(int, int, int) sequentially.

Parameters
srcBitnum:int

source bit number, restricted to [0..size()-1].

dstBitnum:int

destination bit number, restricted to [0..size()-1].

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if bitnum is out of bounds
getback to summary
public final boolean get(final int bitnum) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.Bitfield.get.

Doc from com.jogamp.common.util.Bitfield.get.

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

Parameters
bitnum:int

bit number, restricted to [0..size()-1].

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if bitnum is out of bounds
get32back to summary
public final int get32(final int lowBitnum, final int length) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.Bitfield.get32.

Doc from com.jogamp.common.util.Bitfield.get32.

Returns length bits from this storage, starting with the lowest bit from the storage position lowBitnum.

Parameters
lowBitnum:int

storage bit position of the lowest bit, restricted to [0..size()-length].

length:int

number of bits to read, constrained to [0..32].

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if rightBitnum is out of bounds
putback to summary
public final boolean put(final int bitnum, final boolean bit) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.Bitfield.put.

Doc from com.jogamp.common.util.Bitfield.put.

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

Parameters
bitnum:int

bit number, restricted to [0..size()-1].

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if bitnum is out of bounds
put32back to summary
public final void put32(final int lowBitnum, final int length, final int data) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.Bitfield.put32.

Doc from com.jogamp.common.util.Bitfield.put32.

Puts length bits of given data into this storage, starting w/ the lowest bit to the storage position lowBitnum.

Parameters
lowBitnum:int

storage bit position of the lowest bit, restricted to [0..size()-length].

length:int

number of bits to write, constrained to [0..32].

data:int

the actual bits to be put into this storage

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if rightBitnum is out of bounds
setback to summary
public final void set(final int bitnum) throws IndexOutOfBoundsException

Implements com.jogamp.common.util.Bitfield.set.

Doc from com.jogamp.common.util.Bitfield.set.

Set the bit at position bitnum according to bit.

Parameters
bitnum:int

bit number, restricted to [0..size()-1].

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
if bitnum is out of bounds
sizeback to summary
public int size()

Implements com.jogamp.common.util.Bitfield.size.

Doc from com.jogamp.common.util.Bitfield.size.

Returns the storage size in bit units, e.g. 32 bit for implementations using one int field.

Annotations
@Override