|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jniwrapper.util.FlagSet
public class FlagSet
FlagSet is a flags container and provides simple logical operations using bitmasks.
NOTE: We do not use the BitSet class because it provides setting bits by index but not by the bitmask (flag).
Constructor Summary | |
---|---|
FlagSet()
|
|
FlagSet(long flags)
|
Method Summary | |
---|---|
void |
add(long flag)
Adds the specified flag to the flag set. |
void |
and(long flag)
AND function of existing and specified flags. |
void |
clear()
Sets the flag set to zero. |
boolean |
contains(long flag)
Verifies if the specified flag is present in the flag set. |
boolean |
getBit(int index)
Gets the bit by the specified index. |
int |
getBits(int from,
int to)
Returns the number from specified range of the bits. |
long |
getFlags()
Returns the flag set value. |
static long |
getMask(int from,
int to)
Returns the mask for specified bit range. |
void |
or(long flag)
OR function of existing and specified flags. |
void |
remove(long flag)
Removes the specified flag from the flag set. |
void |
setBit(int index,
boolean set)
Sets or removes the bit by specified index. |
void |
setBits(int from,
int to,
long value)
|
void |
setupFlag(long flag,
boolean set)
Sets the specified flag. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FlagSet()
public FlagSet(long flags)
Method Detail |
---|
public void and(long flag)
AND
function of existing and specified flags.
flag
- public void or(long flag)
OR
function of existing and specified flags.
flag
- public void add(long flag)
or(long)
function.
flag
- flag to add.public void remove(long flag)
flag
- flag to remove.public boolean contains(long flag)
flag
- flag to check.
public void clear()
public long getFlags()
public void setupFlag(long flag, boolean set)
flag
- flag to set or remove.set
- if true - set the flag; false - remove.public java.lang.String toString()
toString
in class java.lang.Object
public int getBits(int from, int to)
from
- specifies begin index of the bits range.to
- specifies end index of the bits range.
public boolean getBit(int index)
index
- the bit index.
public void setBit(int index, boolean set)
index
- the bit index.set
- true - set bit to 1; false - clear the bit.public void setBits(int from, int to, long value)
public static long getMask(int from, int to)
from
- specifies begin index of the bits range.to
- specifies end index of the bits range.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |