Constructor and Description |
---|
BitField(int mask)
Create a BitField instance
|
Modifier and Type | Method and Description |
---|---|
int |
clear(int holder)
Clear the bits.
|
byte |
clearByte(byte holder)
Clear the bits.
|
short |
clearShort(short holder)
Clear the bits.
|
int |
getMask() |
int |
getRawValue(int holder)
Obtain the value for the specified BitField, unshifted
|
short |
getShortRawValue(short holder)
Obtain the value for the specified BitField, unshifted
|
short |
getShortValue(short holder)
Obtain the value for the specified BitField, appropriately
shifted right, as a short.
|
int |
getValue(int holder)
Obtain the value for the specified BitField, appropriately
shifted right.
|
boolean |
isAllSet(int holder)
Are all of the bits set or not? This is a stricter test than
isSet, in that all of the bits in a multi-bit set must be set
for this method to return true
|
boolean |
isSet(int holder)
Is the field set or not? This is most commonly used for a
single-bit field, which is often used to represent a boolean
value; the results of using it for a multi-bit field is to
determine whether *any* of its bits are set
|
int |
set(int holder)
Set the bits.
|
int |
setBoolean(int holder,
boolean flag)
Set a boolean BitField
|
byte |
setByte(byte holder)
Set the bits.
|
byte |
setByteBoolean(byte holder,
boolean flag)
Set a boolean BitField
|
short |
setShort(short holder)
Set the bits.
|
short |
setShortBoolean(short holder,
boolean flag)
Set a boolean BitField
|
short |
setShortValue(short holder,
short value)
Replace the bits with new values.
|
int |
setValue(int holder,
int value)
Replace the bits with new values.
|
public BitField(int mask)
mask
- the mask specifying which bits apply to this
BitField. Bits that are set in this mask are the
bits that this BitField operates onpublic int getValue(int holder)
holder
- the int data containing the bits we're interested
inpublic short getShortValue(short holder)
holder
- the short data containing the bits we're
interested inpublic int getRawValue(int holder)
holder
- the int data containing the bits we're interested
inpublic short getShortRawValue(short holder)
holder
- the short data containing the bits we're
interested inpublic boolean isSet(int holder)
holder
- the int data containing the bits we're interested inpublic boolean isAllSet(int holder)
holder
- the int data containing the bits we're interested inpublic int setValue(int holder, int value)
holder
- the int data containing the bits we're interested invalue
- the new value for the specified bitspublic short setShortValue(short holder, short value)
holder
- the short data containing the bits we're interested invalue
- the new value for the specified bitspublic int clear(int holder)
holder
- the int data containing the bits we're interested inpublic short clearShort(short holder)
holder
- the short data containing the bits we're
interested inpublic byte clearByte(byte holder)
holder
- the byte data containing the bits we're
interested inpublic int set(int holder)
holder
- the int data containing the bits we're interested
inpublic short setShort(short holder)
holder
- the short data containing the bits we're
interested inpublic byte setByte(byte holder)
holder
- the byte data containing the bits we're
interested inpublic int setBoolean(int holder, boolean flag)
holder
- the int data containing the bits we're interested
inflag
- indicating whether to set or clear the bitspublic short setShortBoolean(short holder, boolean flag)
holder
- the short data containing the bits we're
interested inflag
- indicating whether to set or clear the bitspublic byte setByteBoolean(byte holder, boolean flag)
holder
- the byte data containing the bits we're
interested inflag
- indicating whether to set or clear the bitspublic int getMask()
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.