org.jmol.util

Class BitSetUtil

public final class BitSetUtil extends Object

Field Summary
static BitSetbsNull
Method Summary
static voidandNot(BitSet a, BitSet b)
static intcardinalityOf(BitSet bs)
cardinality = "total number of set bits"
static voidclear(BitSet bs)
static booleancompareBits(BitSet a, BitSet b)
static BitSetcopy(BitSet bs)
static voidcopy(BitSet a, BitSet b)
static BitSetcopyInvert(BitSet bs, int n)
static voiddeleteBits(BitSet bs, BitSet bsDelete)
static intfirstSetBit(BitSet bs)
static BitSetinvertInPlace(BitSet bs, int n)
inverts the bitset bits 0 through n-1, and returns a reference to the modified bitset
static intlength(BitSet bs)
length = "last set bit plus one"
static BitSetsetAll(int n)
static BitSettoggleInPlace(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.

Field Detail

bsNull

private static final BitSet bsNull

Method Detail

andNot

public static void andNot(BitSet a, BitSet b)

cardinalityOf

public static int cardinalityOf(BitSet bs)
cardinality = "total number of set bits"

Parameters: bs

Returns: number of set bits

clear

public static void clear(BitSet bs)

compareBits

public static boolean compareBits(BitSet a, BitSet b)

copy

public static BitSet copy(BitSet bs)

copy

public static void copy(BitSet a, BitSet b)

copyInvert

public static BitSet copyInvert(BitSet bs, int n)

deleteBits

public static void deleteBits(BitSet bs, BitSet bsDelete)

firstSetBit

public static int firstSetBit(BitSet bs)

invertInPlace

public static BitSet invertInPlace(BitSet bs, int n)
inverts the bitset bits 0 through n-1, and returns a reference to the modified bitset

Parameters: bs n

Returns: pointer to original bitset, now inverted

length

public static int length(BitSet bs)
length = "last set bit plus one"

Parameters: bs

Returns: the index of the last set bit

setAll

public static BitSet setAll(int n)

toggleInPlace

public 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: a b n

Returns: a handy pointer to the working set, a