public class BitMaskOpt
extends java.lang.Object
History:
| Modifier and Type | Field and Description |
|---|---|
static int[] |
MASK |
static int |
MAX_BIT
the maximum number of bits used.
|
static java.lang.String |
SP |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
Contains(int container,
int value)
Check if a given container object contains a object with a given value.
|
static boolean |
GetBitFlag(int value,
int maskIndex)
Get the bit value (true or false) at the specified index of this object
|
static java.lang.String |
GetBitName(int bitIndex,
java.util.ArrayList<java.lang.String> bitStr)
Get the name at index order of a specified bit (single).
|
static java.lang.String |
GetBitNames(int value,
java.util.ArrayList<java.lang.String> bitStr)
Get the combined bit string (abbreviation) of a specified value.
|
static int |
GetBitValue(int bitIndex)
Get the int value of mask at a specified bit.
|
static void |
main(java.lang.String[] args)
Test driver for this class
|
static int |
UpdateValue(int inValue,
java.util.ArrayList<java.lang.String> strList,
java.lang.String name,
boolean flag)
Get the bit value by adding the specified name for this object
|
static int |
UpdateValue(int inValue,
int bitIndex,
boolean flag)
Get the bit value by adding the specified bit for this object
|
public static final int MAX_BIT
public static final java.lang.String SP
public static final int[] MASK
public static int UpdateValue(int inValue,
int bitIndex,
boolean flag)
inValue - value of optionbitIndex - index of the bit to be setflag - boolean value of the bit to be set (true or false).public static int UpdateValue(int inValue,
java.util.ArrayList<java.lang.String> strList,
java.lang.String name,
boolean flag)
inValue - value of optionstrList - the arraylist of option strname - string of the option to be set.flag - boolean value of the bit to be set (true or false).public static java.lang.String GetBitName(int bitIndex,
java.util.ArrayList<java.lang.String> bitStr)
bitIndex - bit index for finding it's namebitStr - an ArrayList of String - bitStrpublic static java.lang.String GetBitNames(int value,
java.util.ArrayList<java.lang.String> bitStr)
value - number for finding it's combined namebitStr - a Vector of String - bitStrpublic static boolean GetBitFlag(int value,
int maskIndex)
value - value of optionmaskIndex - index of the bit to find it's boolean valuepublic static int GetBitValue(int bitIndex)
bitIndex - the bit index that is interestedpublic static boolean Contains(int container,
int value)
container - a int value of the conatinervalue - a int value of the testing objectpublic static void main(java.lang.String[] args)
args - arguments