public interface BitMask
Modifier and Type | Method and Description |
---|---|
BitMask |
and(BitMask other)
Get the result of a logical and of this bit mask and another.
|
BitMask |
andNot(BitMask other)
Get the result of a logical and of this bit mask and the inverse of another.
|
BitMask |
clear(int pos)
Clear the flag at the given position.
|
BitMask |
cleared()
Get a bit mask from this where all flags are cleared.
|
BitMask |
flip(int pos)
Flip the flag at the given position.
|
int |
getBitCount()
Get the number of possible bits used in this flag.
|
int |
getCardinality()
Get the number of bits set in this flag.
|
int |
getHighestBitSet()
Get the position of the highest bit set.
|
int |
getLowestBitSet()
Get the position of the lowest bit set.
|
boolean |
isEmpty()
Is no flag set?
|
boolean |
isSet(int pos)
Is the flag at the given position set?
|
int |
low32()
Get the lower 32 bits of this mask.
|
long |
low64()
Get the lower 64 bits of this mask.
|
BitMask |
not()
Get the inverse of this bit mask.
|
BitMask |
or(BitMask other)
Get the result of a logical or of this bit mask and another.
|
BitMask |
set(int pos)
Set the flag at the given position.
|
java.util.BitSet |
toBitSet()
Convert this bit mask into a bit set.
|
BitMask |
xor(BitMask other)
Get the result of a logical xor (exclusive or) of this bit mask and another.
|
boolean isSet(int pos)
pos
- position (non-negative)true
: the flag is setfalse
: the flag is not set@NotNull BitMask set(int pos)
pos
- position@NotNull BitMask clear(int pos)
pos
- positionint getBitCount()
int getCardinality()
boolean isEmpty()
true
: if no flag in this bit mask is setfalse
: if any flag in this bit mask is set@NotNull BitMask flip(int pos)
pos
- position@NotNull BitMask and(@NotNull BitMask other)
other
- other bit mask@NotNull BitMask andNot(@NotNull BitMask other)
other
- other bit mask@NotNull BitMask or(@NotNull BitMask other)
other
- other bit mask@NotNull BitMask xor(@NotNull BitMask other)
other
- other bit mask@NotNull java.util.BitSet toBitSet()
int low32()
long low64()
int getLowestBitSet()
-1
if no bit is setint getHighestBitSet()
-1
if no bit is set