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:
Source code:
main
Belongs to CDK module:
standard
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
     
     
  • Method Summary

    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.
    Returns a BitSet representation of the fingerprint.
    int
    Returns the number of bits set to true in the fingerprint.
    boolean
     
    boolean
    get(int index)
    Returns the value of the bit with the specified index.
    int[]
    Returns a listing of the bits in the fingerprint that are set to true.
    int
     
    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
    Returns the size of the fingerprint, i.e., the number of hash bins.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BitSetFingerprint

      public BitSetFingerprint(BitSet bitset)
    • BitSetFingerprint

      public BitSetFingerprint()
    • BitSetFingerprint

      public BitSetFingerprint(int size)
    • BitSetFingerprint

      public BitSetFingerprint(IBitFingerprint fingerprint)
  • Method Details

    • cardinality

      public int cardinality()
      Description copied from interface: IBitFingerprint
      Returns the number of bits set to true in the fingerprint.
      Specified by:
      cardinality in interface IBitFingerprint
      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 interface IBitFingerprint
      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 value true if and only if it both initially had the value true and the corresponding bit in the fingerprint argument also had the value true.
      Specified by:
      and in interface IBitFingerprint
      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 value true if and only if it either already had the value true or the corresponding bit in the bit set argument has the value true.
      Specified by:
      or in interface IBitFingerprint
      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 is true if the bit with the index index is currently set in this fingerprint; otherwise, the result is false.
      Specified by:
      get in interface IBitFingerprint
      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 interface IBitFingerprint
      Parameters:
      index - the index of the bit to change
      b - the new value for the bit at position index
    • asBitSet

      public BitSet asBitSet()
      Description copied from interface: IBitFingerprint
      Returns a BitSet representation of the fingerprint. This might take significantly more memory!
      Specified by:
      asBitSet in interface IBitFingerprint
      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 interface IBitFingerprint
      Parameters:
      i - index
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • 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 interface IBitFingerprint
      Returns:
      listing of all bits that are set