Modifier and Type | Field and Description |
---|---|
static BitSetBitMask |
ZERO
Bit set bit mask with no bits set.
|
Constructor and Description |
---|
BitSetBitMask(java.util.BitSet bitSet)
Constructor.
|
BitSetBitMask(int flagCount)
Constructor.
|
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.
|
boolean |
equals(java.lang.Object o) |
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.
|
int |
hashCode() |
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.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
BitMask |
xor(BitMask other)
Get the result of a logical xor (exclusive or) of this bit mask and another.
|
public static final BitSetBitMask ZERO
public BitSetBitMask(@NotNull java.util.BitSet bitSet)
bitSet
- flags on which this mask is basedpublic BitSetBitMask(int flagCount)
flagCount
- flag countpublic boolean isSet(int pos)
public int getBitCount()
getBitCount
in interface BitMask
public int getCardinality()
getCardinality
in interface BitMask
public boolean isEmpty()
@NotNull public BitMask and(@NotNull BitMask other)
@NotNull public BitMask andNot(@NotNull BitMask other)
@NotNull public BitMask or(@NotNull BitMask other)
@NotNull public BitMask xor(@NotNull BitMask other)
@NotNull public java.util.BitSet toBitSet()
public int low32()
public long low64()
public int getLowestBitSet()
BitMask
getLowestBitSet
in interface BitMask
-1
if no bit is setpublic int getHighestBitSet()
BitMask
getHighestBitSet
in interface BitMask
-1
if no bit is set@NotNull public BitMask cleared()
BitMask
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
in class java.lang.Object