test_class.file: src/com/aestel/chemistry/openEye/fp/ByteFingerprintTest.java
test_class.identifier: ByteFingerprintTest
test_case.body: @Test()
     public void testTanimoto()
     {  assert new ByteFingerprint("7F8")
           .tanimoto(new ByteFingerprint("7F8"))
           == 1D;
  
        assert new ByteFingerprint("FFA")        //11111111 11
           .tanimoto(new ByteFingerprint("7FA")) //01111111 11
           == 9D/10D;
  
        assert new ByteFingerprint("FFA")         //1111 1111 1010 0000
           .mtanimoto(new ByteFingerprint("7FA")) //0111 1111 1010 0000
           == 9D/11D;
  
        assert new ByteFingerprint("FFA1")      // 1111 1111 1010 0001
           .tanimoto(new ByteFingerprint("7FA"))// 0111 1111 1010 0000
           == 9D/11D;
  
        assert new ByteFingerprint(
              new SparseFingerprint(new int[] {0,1,2,33,4,5,64,7,8,999}).getHexString())
           .tanimoto(new ByteFingerprint(
                 new SparseFingerprint(new int[] { 0,1,2,33,4,5,64,7,8,9}).getHexString()))
           == 9D/11D;
     }
test_case.class_method_signature: ByteFingerprintTest.testTanimoto()
test_case.full_signature: @Test() public void testTanimoto()
test_case.identifier: testTanimoto
test_case.invocations: tanimoto tanimoto mtanimoto tanimoto tanimoto getHexString getHexString
test_case.modifiers: @Test() public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testTanimoto()
focal_class.declarator: bytes
focal_class.modifier: private final
focal_class.original_string: private final byte[] bytes;
focal_class.type: byte[]
focal_class.var_name: bytes
focal_class.declarator: nBits
focal_class.modifier: private final
focal_class.original_string: private final int nBits;
focal_class.type: int
focal_class.var_name: nBits
focal_class.declarator: BYTEBitcount = new int[]
     {  0,1,1,2,1,2,2,3, 1,2,2,3,2,3,3,4,  1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,
        1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,  2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
        1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,  2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
        2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,  3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
        1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,  2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
        2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,  3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
        2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,  3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
        3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,  4,5,5,6,5,6,6,7, 5,6,6,7,6,7,7,8
     }
focal_class.modifier: static final
focal_class.original_string: static final int[] BYTEBitcount = new int[]
     {  0,1,1,2,1,2,2,3, 1,2,2,3,2,3,3,4,  1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,
        1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,  2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
        1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,  2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
        2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,  3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
        1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,  2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
        2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,  3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
        2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,  3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
        3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,  4,5,5,6,5,6,6,7, 5,6,6,7,6,7,7,8
     };
focal_class.type: int[]
focal_class.var_name: BYTEBitcount
focal_class.file: src/com/aestel/chemistry/openEye/fp/ByteFingerprint.java
focal_class.identifier: ByteFingerprint
focal_class.interfaces: implements Fingerprint
focal_class.class_method_signature: ByteFingerprint.ByteFingerprint(String hex)
focal_class.full_signature: public  ByteFingerprint(String hex)
focal_class.identifier: ByteFingerprint
focal_class.modifiers: public
focal_class.parameters: (String hex)
focal_class.signature:  ByteFingerprint(String hex)
focal_class.class_method_signature: ByteFingerprint.ByteFingerprint(byte[] bytes)
focal_class.full_signature: public  ByteFingerprint(byte[] bytes)
focal_class.identifier: ByteFingerprint
focal_class.modifiers: public
focal_class.parameters: (byte[] bytes)
focal_class.signature:  ByteFingerprint(byte[] bytes)
focal_class.class_method_signature: ByteFingerprint.tanimoto(Fingerprint other)
focal_class.full_signature: @Override public double tanimoto(Fingerprint other)
focal_class.identifier: tanimoto
focal_class.modifiers: @Override public
focal_class.parameters: (Fingerprint other)
focal_class.return: double
focal_class.signature: double tanimoto(Fingerprint other)
focal_class.class_method_signature: ByteFingerprint.mtanimoto(Fingerprint other)
focal_class.full_signature: public double mtanimoto(Fingerprint other)
focal_class.identifier: mtanimoto
focal_class.modifiers: public
focal_class.parameters: (Fingerprint other)
focal_class.return: double
focal_class.signature: double mtanimoto(Fingerprint other)
focal_class.class_method_signature: ByteFingerprint.fold(int size)
focal_class.full_signature: @Override public Fingerprint fold(int size)
focal_class.identifier: fold
focal_class.modifiers: @Override public
focal_class.parameters: (int size)
focal_class.return: Fingerprint
focal_class.signature: Fingerprint fold(int size)
focal_class.class_method_signature: ByteFingerprint.getBinString()
focal_class.full_signature: @Override public String getBinString()
focal_class.identifier: getBinString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getBinString()
focal_class.class_method_signature: ByteFingerprint.getBits()
focal_class.full_signature: @Override public int[] getBits()
focal_class.identifier: getBits
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int[]
focal_class.signature: int[] getBits()
focal_class.class_method_signature: ByteFingerprint.getHexString()
focal_class.full_signature: @Override public String getHexString()
focal_class.identifier: getHexString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getHexString()
focal_class.class_method_signature: ByteFingerprint.getNBits()
focal_class.full_signature: @Override public int getNBits()
focal_class.identifier: getNBits
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getNBits()
focal_class.class_method_signature: ByteFingerprint.main(String ... args)
focal_class.full_signature: public static void main(String ... args)
focal_class.identifier: main
focal_class.modifiers: public static
focal_class.parameters: (String ... args)
focal_class.return: void
focal_class.signature: void main(String ... args)
focal_method.body: @Override
     public double tanimoto(Fingerprint other)
     {  if( ! (other instanceof ByteFingerprint) )
           throw new Error("Not supported yet needs ByteFingerprint");
  
        if( this.nBits == 0 && other.getNBits() == 0) return 1;
  
        byte[] fp_1 = this.bytes;
        byte[] fp_2 = ((ByteFingerprint) other).bytes;
  
        int andBitCount = 0;  // number of bits present in both
        int orBitCount = 0;   // number of bits present in either
  
        int i=0;
        byte[] longerFP;
        int len;
        if( fp_1.length < fp_2.length)
        {  longerFP = fp_2;
           len = fp_1.length;
        }else
        {  longerFP = fp_1;
           len = fp_2.length;
        }
  
        // we could possibly convert to long in 16 ops and then do the and/or
        // and count on the long values more efficiently but I am not sure
        for( ; i<len; i++)
        {  andBitCount += BYTEBitcount[ fp_1[i]  & fp_2[i]  & 0xFF ];
           orBitCount  += BYTEBitcount[ (fp_1[i] | fp_2[i]) & 0xFF ];
        }
  
        len = longerFP.length;
        for( ; i<len; i++)
           orBitCount += BYTEBitcount[ longerFP[i] & 0xFF ];
  
  //System.err.printf("and=%d or=%d ", andBitCount, orBitCount);
        return ( (double) andBitCount )/orBitCount;
     }
focal_method.class_method_signature: ByteFingerprint.tanimoto(Fingerprint other)
focal_method.full_signature: @Override public double tanimoto(Fingerprint other)
focal_method.identifier: tanimoto
focal_method.invocations: getNBits
focal_method.modifiers: @Override public
focal_method.parameters: (Fingerprint other)
focal_method.return: double
focal_method.signature: double tanimoto(Fingerprint other)