jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
jau.util.SyncedBitfield Class Reference

Simple synchronized Bitfield by wrapping an existing Bitfield. More...

Inheritance diagram for jau.util.SyncedBitfield:
Collaboration diagram for jau.util.SyncedBitfield:

Public Member Functions

 SyncedBitfield (final Bitfield impl)
 
final synchronized int size ()
 Returns the storage size in bit units, e.g.
 
final synchronized void clearField (final boolean bit)
 Set all bits of this bitfield to the given value bit.
 
final synchronized int get32 (final int lowBitnum, final int length) throws IndexOutOfBoundsException
 Returns length bits from this storage, starting with the lowest bit from the storage position lowBitnum.
 
final synchronized void put32 (final int lowBitnum, final int length, final int data) throws IndexOutOfBoundsException
 Puts length bits of given data into this storage, starting w/ the lowest bit to the storage position lowBitnum.
 
final synchronized int copy32 (final int srcLowBitnum, final int dstLowBitnum, final int length) throws IndexOutOfBoundsException
 Copies length bits at position srcLowBitnum to position dstLowBitnum and returning the bits.
 
final synchronized boolean get (final int bitnum) throws IndexOutOfBoundsException
 Return true if the bit at position bitnum is set, otherwise false.
 
final synchronized boolean put (final int bitnum, final boolean bit) throws IndexOutOfBoundsException
 Set or clear the bit at position bitnum according to bit and return the previous value.
 
final synchronized void set (final int bitnum) throws IndexOutOfBoundsException
 Set the bit at position bitnum according to bit.
 
final synchronized void clear (final int bitnum) throws IndexOutOfBoundsException
 Clear the bit at position bitnum according to bit.
 
final synchronized boolean copy (final int srcBitnum, final int dstBitnum) throws IndexOutOfBoundsException
 Copies the bit at position srcBitnum to position dstBitnum and returning true if the bit is set, otherwise false.
 
final synchronized int bitCount ()
 Returns the number of one bits within this bitfield.
 

Detailed Description

Simple synchronized Bitfield by wrapping an existing Bitfield.

Definition at line 33 of file SyncedBitfield.java.

Constructor & Destructor Documentation

◆ SyncedBitfield()

jau.util.SyncedBitfield.SyncedBitfield ( final Bitfield impl)

Definition at line 36 of file SyncedBitfield.java.

Member Function Documentation

◆ bitCount()

final synchronized int jau.util.SyncedBitfield.bitCount ( )

Returns the number of one bits within this bitfield.

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

Implements org.jau.util.Bitfield.

Definition at line 91 of file SyncedBitfield.java.

◆ clear()

final synchronized void jau.util.SyncedBitfield.clear ( final int bitnum) throws IndexOutOfBoundsException

Clear the bit at position bitnum according to bit.

Parameters
bitnumbit number, restricted to [0..size()-1].
Exceptions
IndexOutOfBoundsExceptionif bitnum is out of bounds

Implements org.jau.util.Bitfield.

Definition at line 81 of file SyncedBitfield.java.

◆ clearField()

final synchronized void jau.util.SyncedBitfield.clearField ( final boolean bit)

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

Implements org.jau.util.Bitfield.

Definition at line 46 of file SyncedBitfield.java.

◆ copy()

final synchronized boolean jau.util.SyncedBitfield.copy ( final int srcBitnum,
final int dstBitnum ) throws IndexOutOfBoundsException

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

Parameters
srcBitnumsource bit number, restricted to [0..size()-1].
dstBitnumdestination bit number, restricted to [0..size()-1].
Exceptions
IndexOutOfBoundsExceptionif bitnum is out of bounds

Implements org.jau.util.Bitfield.

Definition at line 86 of file SyncedBitfield.java.

◆ copy32()

final synchronized int jau.util.SyncedBitfield.copy32 ( final int srcLowBitnum,
final int dstLowBitnum,
final int length ) throws IndexOutOfBoundsException

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
srcLowBitnumsource bit number, restricted to [0..size()-1].
dstLowBitnumdestination bit number, restricted to [0..size()-1].
Exceptions
IndexOutOfBoundsExceptionif bitnum is out of bounds
See also
get32(int, int)
put32(int, int, int)

Implements org.jau.util.Bitfield.

Definition at line 61 of file SyncedBitfield.java.

◆ get()

final synchronized boolean jau.util.SyncedBitfield.get ( final int bitnum) throws IndexOutOfBoundsException

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

Parameters
bitnumbit number, restricted to [0..size()-1].
Exceptions
IndexOutOfBoundsExceptionif bitnum is out of bounds

Implements org.jau.util.Bitfield.

Definition at line 66 of file SyncedBitfield.java.

◆ get32()

final synchronized int jau.util.SyncedBitfield.get32 ( final int lowBitnum,
final int length ) throws IndexOutOfBoundsException

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

Parameters
lowBitnumstorage bit position of the lowest bit, restricted to [0..size()-length].
lengthnumber of bits to read, constrained to [0..32].
Exceptions
IndexOutOfBoundsExceptionif rightBitnum is out of bounds
See also
put32(int, int, int)

Implements org.jau.util.Bitfield.

Definition at line 51 of file SyncedBitfield.java.

◆ put()

final synchronized boolean jau.util.SyncedBitfield.put ( final int bitnum,
final boolean bit ) throws IndexOutOfBoundsException

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

Parameters
bitnumbit number, restricted to [0..size()-1].
Exceptions
IndexOutOfBoundsExceptionif bitnum is out of bounds

Implements org.jau.util.Bitfield.

Definition at line 71 of file SyncedBitfield.java.

◆ put32()

final synchronized void jau.util.SyncedBitfield.put32 ( final int lowBitnum,
final int length,
final int data ) throws IndexOutOfBoundsException

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

Parameters
lowBitnumstorage bit position of the lowest bit, restricted to [0..size()-length].
lengthnumber of bits to write, constrained to [0..32].
datathe actual bits to be put into this storage
Exceptions
IndexOutOfBoundsExceptionif rightBitnum is out of bounds
See also
get32(int, int)

Implements org.jau.util.Bitfield.

Definition at line 56 of file SyncedBitfield.java.

◆ set()

final synchronized void jau.util.SyncedBitfield.set ( final int bitnum) throws IndexOutOfBoundsException

Set the bit at position bitnum according to bit.

Parameters
bitnumbit number, restricted to [0..size()-1].
Exceptions
IndexOutOfBoundsExceptionif bitnum is out of bounds

Implements org.jau.util.Bitfield.

Definition at line 76 of file SyncedBitfield.java.

◆ size()

final synchronized int jau.util.SyncedBitfield.size ( )

Returns the storage size in bit units, e.g.

32 bit for implementations using one int field.

Implements org.jau.util.Bitfield.

Definition at line 41 of file SyncedBitfield.java.


The documentation for this class was generated from the following file: