org.jmol.util
public final class BitSetUtil extends Object
Field Summary | |
---|---|
static BitSet | bsNull |
Method Summary | |
---|---|
static void | andNot(BitSet a, BitSet b) |
static int | cardinalityOf(BitSet bs)
cardinality = "total number of set bits" |
static void | clear(BitSet bs) |
static boolean | compareBits(BitSet a, BitSet b) |
static BitSet | copy(BitSet bs) |
static void | copy(BitSet a, BitSet b) |
static BitSet | copyInvert(BitSet bs, int n) |
static void | deleteBits(BitSet bs, BitSet bsDelete) |
static int | firstSetBit(BitSet bs) |
static BitSet | invertInPlace(BitSet bs, int n)
inverts the bitset bits 0 through n-1,
and returns a reference to the modified bitset
|
static int | length(BitSet bs)
length = "last set bit plus one"
|
static BitSet | setAll(int n) |
static BitSet | toggleInPlace(BitSet a, BitSet b, int n)
a perhaps curious method:
b is a reference set, perhaps all atoms in a certain molecule
a is the working set, perhaps representing all displayed atoms
For each set bit in b:
a) if a is also set, then clear a's bit UNLESS
b) if a is not set, then add to a all set bits of b
In "toggle" mode, when you click on any atom of the molecule,
you want either:
(a) all the atoms in the molecule to be displayed if not
all are already displayed,
or
(b) the whole molecule to be hidden if all the atoms of the
molecule are already displayed.
|
Parameters: bs
Returns: number of set bits
Parameters: bs n
Returns: pointer to original bitset, now inverted
Parameters: bs
Returns: the index of the last set bit
Parameters: a b n
Returns: a handy pointer to the working set, a