Package org.openscience.cdk.fingerprint
Class IntArrayCountFingerprint
- java.lang.Object
-
- org.openscience.cdk.fingerprint.IntArrayCountFingerprint
-
- All Implemented Interfaces:
Serializable
,ICountFingerprint
public class IntArrayCountFingerprint extends Object implements ICountFingerprint
- Author:
- jonalv
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- standard
-
-
Constructor Summary
Constructors Constructor Description IntArrayCountFingerprint()
IntArrayCountFingerprint(Map<String,Integer> rawFingerprint)
IntArrayCountFingerprint(Map<String,Integer> rawFingerprint, boolean behaveAsBitFingerprint)
Create anIntArrayCountFingerprint
from a rawFingerprint and ifbehaveAsBitFingerprint
make it only return 0 or 1 as count thus behaving like a bit finger print.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCount(int index)
Returns the count value for the bin with the given index.int
getCountForHash(int hash)
Get the number of times a certain hash exists in the fingerprint.int
getHash(int index)
Returns the hash corresponding to the given index in the fingerprint.boolean
hasHash(int hash)
Whether the fingerprint contains the given hash.void
merge(ICountFingerprint fp)
Merge all fromfp
into the current fingerprint.int
numOfPopulatedbins()
Returns the number of bins that are populated.void
setBehaveAsBitFingerprint(boolean behaveAsBitFingerprint)
Changes behaviour, if true is given the count fingerprint will behave as a bit fingerprint and return 0 or 1 for counts.long
size()
Returns the number of bits of this fingerprint.
-
-
-
Constructor Detail
-
IntArrayCountFingerprint
public IntArrayCountFingerprint()
-
IntArrayCountFingerprint
public IntArrayCountFingerprint(Map<String,Integer> rawFingerprint, boolean behaveAsBitFingerprint)
Create anIntArrayCountFingerprint
from a rawFingerprint and ifbehaveAsBitFingerprint
make it only return 0 or 1 as count thus behaving like a bit finger print.- Parameters:
rawFingerprint
- the raw fpbehaveAsBitFingerprint
- whether to behave as binary fp or not
-
-
Method Detail
-
size
public long size()
Description copied from interface:ICountFingerprint
Returns the number of bits of this fingerprint.- Specified by:
size
in interfaceICountFingerprint
- Returns:
- the size of the fingerprint.
-
getCount
public int getCount(int index)
Description copied from interface:ICountFingerprint
Returns the count value for the bin with the given index.- Specified by:
getCount
in interfaceICountFingerprint
- Parameters:
index
- the index of the bin to return the number of hits for.- Returns:
- the count for the bin with given index.
-
getHash
public int getHash(int index)
Description copied from interface:ICountFingerprint
Returns the hash corresponding to the given index in the fingerprint.- Specified by:
getHash
in interfaceICountFingerprint
- Parameters:
index
- the index of the bin to return the hash for.- Returns:
- the hash for the bin with the given index.
-
numOfPopulatedbins
public int numOfPopulatedbins()
Description copied from interface:ICountFingerprint
Returns the number of bins that are populated. This number is typically smaller then the total number of bins.- Specified by:
numOfPopulatedbins
in interfaceICountFingerprint
- Returns:
- the number of populated bins
- See Also:
ICountFingerprint.size()
-
merge
public void merge(ICountFingerprint fp)
Description copied from interface:ICountFingerprint
Merge all fromfp
into the current fingerprint.- Specified by:
merge
in interfaceICountFingerprint
- Parameters:
fp
- to be merged
-
setBehaveAsBitFingerprint
public void setBehaveAsBitFingerprint(boolean behaveAsBitFingerprint)
Description copied from interface:ICountFingerprint
Changes behaviour, if true is given the count fingerprint will behave as a bit fingerprint and return 0 or 1 for counts.- Specified by:
setBehaveAsBitFingerprint
in interfaceICountFingerprint
-
hasHash
public boolean hasHash(int hash)
Description copied from interface:ICountFingerprint
Whether the fingerprint contains the given hash.- Specified by:
hasHash
in interfaceICountFingerprint
- Returns:
- true if the fingerprint contains the given hash, otherwise false.
-
getCountForHash
public int getCountForHash(int hash)
Description copied from interface:ICountFingerprint
Get the number of times a certain hash exists in the fingerprint.- Specified by:
getCountForHash
in interfaceICountFingerprint
- Returns:
- the number associated with the given hash
-
-