Package org.openscience.cdk.fingerprint
Class BitSetFingerprint
- java.lang.Object
-
- org.openscience.cdk.fingerprint.BitSetFingerprint
-
- All Implemented Interfaces:
Serializable
,IBitFingerprint
public class BitSetFingerprint extends Object implements IBitFingerprint
- Author:
- jonalv
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- standard
-
-
Constructor Summary
Constructors Constructor Description BitSetFingerprint()
BitSetFingerprint(int size)
BitSetFingerprint(BitSet bitset)
BitSetFingerprint(IBitFingerprint fingerprint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
and(IBitFingerprint fingerprint)
Performs a logical AND of the bits in this target bit set with the bits in the argument fingerprint.BitSet
asBitSet()
Returns aBitSet
representation of the fingerprint.int
cardinality()
Returns the number of bits set to true in the fingerprint.boolean
equals(Object obj)
boolean
get(int index)
Returns the value of the bit with the specified index.int[]
getSetbits()
Returns a listing of the bits in the fingerprint that are set to true.int
hashCode()
void
or(IBitFingerprint fingerprint)
Performs a logical OR of the bits in this target bit set with the bits in the argument fingerprint.void
set(int i)
Sets the bit at the specified index to true.void
set(int index, boolean b)
Sets the bit at the specified index to the specified value.long
size()
Returns the size of the fingerprint, i.e., the number of hash bins.
-
-
-
Constructor Detail
-
BitSetFingerprint
public BitSetFingerprint(BitSet bitset)
-
BitSetFingerprint
public BitSetFingerprint()
-
BitSetFingerprint
public BitSetFingerprint(int size)
-
BitSetFingerprint
public BitSetFingerprint(IBitFingerprint fingerprint)
-
-
Method Detail
-
cardinality
public int cardinality()
Description copied from interface:IBitFingerprint
Returns the number of bits set to true in the fingerprint.- Specified by:
cardinality
in interfaceIBitFingerprint
- Returns:
- the number of true bits.
-
size
public long size()
Description copied from interface:IBitFingerprint
Returns the size of the fingerprint, i.e., the number of hash bins.- Specified by:
size
in interfaceIBitFingerprint
- Returns:
- the size of the fingerprint.
-
and
public void and(IBitFingerprint fingerprint)
Description copied from interface:IBitFingerprint
Performs a logical AND of the bits in this target bit set with the bits in the argument fingerprint. This fingerprint is modified so that each bit in it has the valuetrue
if and only if it both initially had the valuetrue
and the corresponding bit in the fingerprint argument also had the valuetrue
.- Specified by:
and
in interfaceIBitFingerprint
- Parameters:
fingerprint
- the fingerprint with which to perform the AND operation
-
or
public void or(IBitFingerprint fingerprint)
Description copied from interface:IBitFingerprint
Performs a logical OR of the bits in this target bit set with the bits in the argument fingerprint. This operation can also be seen as merging two fingerprints. This fingerprint is modified so that each bit in it has the valuetrue
if and only if it either already had the valuetrue
or the corresponding bit in the bit set argument has the valuetrue
.- Specified by:
or
in interfaceIBitFingerprint
- Parameters:
fingerprint
- the fingerprint with which to perform the OR operation
-
get
public boolean get(int index)
Description copied from interface:IBitFingerprint
Returns the value of the bit with the specified index. The value istrue
if the bit with the indexindex
is currently set in this fingerprint; otherwise, the result isfalse
.- Specified by:
get
in interfaceIBitFingerprint
- Parameters:
index
- the index of the bit to return the value for- Returns:
- the value of the bit at
index
-
set
public void set(int index, boolean b)
Description copied from interface:IBitFingerprint
Sets the bit at the specified index to the specified value.- Specified by:
set
in interfaceIBitFingerprint
- Parameters:
index
- the index of the bit to changeb
- the new value for the bit at positionindex
-
asBitSet
public BitSet asBitSet()
Description copied from interface:IBitFingerprint
Returns aBitSet
representation of the fingerprint. This might take significantly more memory!- Specified by:
asBitSet
in interfaceIBitFingerprint
- Returns:
- the fingerprint as a
BitSet
-
set
public void set(int i)
Description copied from interface:IBitFingerprint
Sets the bit at the specified index to true.- Specified by:
set
in interfaceIBitFingerprint
- Parameters:
i
- index
-
getSetbits
public int[] getSetbits()
Description copied from interface:IBitFingerprint
Returns a listing of the bits in the fingerprint that are set to true.- Specified by:
getSetbits
in interfaceIBitFingerprint
- Returns:
- listing of all bits that are set
-
-