Package org.openscience.cdk.fingerprint
Interface IBitFingerprint
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
BitSetFingerprint
,IntArrayFingerprint
public interface IBitFingerprint extends Serializable
Interface for bit fingerprint representations.- Author:
- jonalv
- Source code:
- main
- Belongs to CDK module:
- core
-
-
Method Summary
All Methods Instance Methods Abstract 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
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.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 value)
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.
-
-
-
Method Detail
-
cardinality
int cardinality()
Returns the number of bits set to true in the fingerprint.- Returns:
- the number of true bits.
-
size
long size()
Returns the size of the fingerprint, i.e., the number of hash bins.- Returns:
- the size of the fingerprint.
-
and
void and(IBitFingerprint fingerprint)
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
.- Parameters:
fingerprint
- the fingerprint with which to perform the AND operation- Throws:
IllegalArgumentException
- if the two fingerprints are not of same size
-
or
void or(IBitFingerprint fingerprint)
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
.- Parameters:
fingerprint
- the fingerprint with which to perform the OR operation- Throws:
IllegalArgumentException
- if the two fingerprints are not of same size
-
get
boolean get(int index)
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
.- Parameters:
index
- the index of the bit to return the value for- Returns:
- the value of the bit at
index
-
set
void set(int index, boolean value)
Sets the bit at the specified index to the specified value.- Parameters:
index
- the index of the bit to changevalue
- the new value for the bit at positionindex
-
asBitSet
BitSet asBitSet()
Returns aBitSet
representation of the fingerprint. This might take significantly more memory!- Returns:
- the fingerprint as a
BitSet
-
set
void set(int i)
Sets the bit at the specified index to true.- Parameters:
i
- index
-
getSetbits
int[] getSetbits()
Returns a listing of the bits in the fingerprint that are set to true.- Returns:
- listing of all bits that are set
-
-