public final class BSUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static javajs.util.BS |
emptySet |
Constructor and Description |
---|
BSUtil() |
Modifier and Type | Method and Description |
---|---|
static javajs.util.BS |
andNot(javajs.util.BS a,
javajs.util.BS b) |
static boolean |
areEqual(javajs.util.BS a,
javajs.util.BS b) |
static int |
cardinalityOf(javajs.util.BS bs)
cardinality = "total number of set bits"
|
static javajs.util.BS |
copy(javajs.util.BS bs) |
static javajs.util.BS |
copy2(javajs.util.BS a,
javajs.util.BS b) |
static javajs.util.BS |
copyInvert(javajs.util.BS bs,
int n) |
static javajs.util.BS |
deleteBits(javajs.util.BS bs,
javajs.util.BS bsDelete)
this one slides deleted bits out of a pattern.
|
static boolean |
haveCommon(javajs.util.BS a,
javajs.util.BS b) |
static javajs.util.BS |
invertInPlace(javajs.util.BS bs,
int n)
inverts the bitset bits 0 through n-1,
and returns a reference to the modified bitset
|
static javajs.util.BS |
newAndSetBit(int i) |
static javajs.util.BS |
newBitSet2(int i0,
int i1) |
static void |
offset(javajs.util.BS bs0,
int pos,
int offset)
offset the bitset in place by the specified number of bits
starting at a given position
|
static javajs.util.BS |
setAll(int n) |
static void |
setMapBitSet(java.util.Map<java.lang.String,javajs.util.BS> ht,
int i1,
int i2,
java.lang.String key) |
static void |
shiftBits(javajs.util.BS bs,
javajs.util.BS bsAdded,
boolean setIfFound,
int iLast)
this one slides bits to higher positions based on a pattern.
|
static javajs.util.BS |
toggleInPlace(javajs.util.BS a,
javajs.util.BS b)
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
Thus, if a equals b --> clear all if a is a subset of b, then --> b if b is
a subset of a, then --> a not b if a only intersects with b, then --> a or
b if a does not intersect with b, then a or 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.
|
public static javajs.util.BS newAndSetBit(int i)
public static boolean areEqual(javajs.util.BS a, javajs.util.BS b)
public static boolean haveCommon(javajs.util.BS a, javajs.util.BS b)
public static int cardinalityOf(javajs.util.BS bs)
bs
- public static javajs.util.BS newBitSet2(int i0, int i1)
public static javajs.util.BS setAll(int n)
public static javajs.util.BS andNot(javajs.util.BS a, javajs.util.BS b)
public static javajs.util.BS copy(javajs.util.BS bs)
public static javajs.util.BS copy2(javajs.util.BS a, javajs.util.BS b)
public static javajs.util.BS copyInvert(javajs.util.BS bs, int n)
public static javajs.util.BS invertInPlace(javajs.util.BS bs, int n)
bs
- n
- public static javajs.util.BS toggleInPlace(javajs.util.BS a, javajs.util.BS b)
a
- b
- public static javajs.util.BS deleteBits(javajs.util.BS bs, javajs.util.BS bsDelete)
bs
- bsDelete
- public static void shiftBits(javajs.util.BS bs, javajs.util.BS bsAdded, boolean setIfFound, int iLast)
bs
- bsAdded
- setIfFound
- iLast
- public static void offset(javajs.util.BS bs0, int pos, int offset)
bs0
- pos
- starting position; no change before thisoffset
- public static void setMapBitSet(java.util.Map<java.lang.String,javajs.util.BS> ht, int i1, int i2, java.lang.String key)