|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.ide.util.BitField
Utility class for manipulating a set of bit flags in an integer bit mask.
Constructor Summary | |
BitField()
Creates a new BitField . |
|
BitField(int bits)
Creates a new BitField whose initial bits are defined by
the specified bit mask. |
Method Summary | |
void |
clear(int bitIndex)
Deprecated. Replace with {#unset(int)}. |
int |
get(int bitIndex)
Returns the value of this BitField after masking all bits
except the specified bit. |
int |
getField()
Returns the full bit mask for this BitField . |
int |
getSize()
Returns the "logical size" of this BitField , which is the
index of the highest set bit in the BitField plus one. |
boolean |
isSet(int bitIndex)
Tests whether the bit specified by the index is set. |
static boolean |
isSet(int bits,
int mask)
Tests whether one or more bits are set in an external field of bits. |
void |
set(int bitIndex)
Sets the bit specified by the index to 1 . |
static int |
set(int bits,
int mask)
Sets one or more bits in an external field of bits to 1 . |
void |
setField(int bits)
Sets the full bit mask for this BitField . |
void |
toggle(int bitIndex)
Toggles the bit specified by the index. |
static int |
toggle(int bits,
int mask)
Toggles one or more bits in an external field of bits. |
void |
unset(int bitIndex)
Sets the bit specified by the index to 0 . |
static int |
unset(int bits,
int mask)
Sets one or more bits in an external field of bits to 0 . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BitField()
BitField
. All bits are initially
0
.
public BitField(int bits)
BitField
whose initial bits are defined by
the specified bit mask.
bits
- the initial bit mask.Method Detail |
public int getSize()
BitField
, which is the
index of the highest set bit in the BitField
plus one.
Returns zero if the BitField
contains no set bits.
BitField
.public void set(int bitIndex)
1
.
bitIndex
- the index of the bit to be set.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range.public void unset(int bitIndex)
0
.
bitIndex
- the index of the bit to be cleared.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range.public void clear(int bitIndex)
public void toggle(int bitIndex)
bitIndex
- the index of the bit to be toggled.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range.public boolean isSet(int bitIndex)
bitIndex
- the index of the bit to be tested.
true
if the bit is set; otherwise
false
.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range.public int get(int bitIndex)
BitField
after masking all bits
except the specified bit.
bitIndex
- the index of the bit to be tested.
java.lang.IndexOutOfBoundsException
- if the specified index is out of
range.public int getField()
BitField
.
public void setField(int bits)
BitField
.
public static boolean isSet(int bits, int mask)
bits
- the external field of bits.mask
- the bit or set of bits to test against the bit field.
true
if all of the specified bits are set in the
external bit field; false
if any of the bits are not set,
or if the mask
is zero.public static int set(int bits, int mask)
1
.
bits
- the external field of bits.mask
- the bit or set of bits to set in the bit field.
public static int unset(int bits, int mask)
0
.
bits
- the external field of bits.mask
- the bit or set of bits to clear in the bit field.
public static int toggle(int bits, int mask)
bits
- the external field of bits.mask
- the bit or set of bits to toggle in the bit field.
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.