From: Nina J. <ni...@ac...> - 2005-09-27 09:22:53
|
Hi all, I've just submited this bug on sourceforge, but i am reposting here since it may be a general issue after interfaces introduction (this was not a problem in the 28/06/2005 release ) Essentially, when UniversalIsomorphismTester invokes AnyOrderQueryBond matches method, the SMARTSBond matches method is called instead! This is because <code> AnyOrderQueryBond in package org.openscience.cdk.isomorphism.matchers.smarts; </code> should have public boolean matches(Bond bond) declared as <code> public boolean matches(org.openscience.cdk.interfaces.Bond bond) </code> Now it assumes bond is of type org.openscience.cdk.Bond (because of the import statement) and therefore matches method DOES NOT replace the inherited matches method of SMARTSBond (which returns false ). Here the fix is simple, but there can be other hidden situation like this. The effect is clear from the test below : <code> public void testmatchInherited() { try { SymbolQueryAtom c1 = new SymbolQueryAtom(new Atom("C")); SymbolAndChargeQueryAtom c2 = new SymbolAndChargeQueryAtom(new Atom("C")); org.openscience.cdk.interfaces.AtomContainer c = MoleculeFactory.makeAlkane(2); QueryAtomContainer query1 = new QueryAtomContainer(); query1.addAtom(c1); query1.addAtom(c2); query1.addBond(new OrderQueryBond(c1,c2, CDKConstants.BONDORDER_SINGLE)); assertTrue(UniversalIsomorphismTester.isSubgraph(c,query1)); QueryAtomContainer query = new QueryAtomContainer(); query.addAtom(c1); query.addAtom(c2); query.addBond(new AnyOrderQueryBond(c1,c2, CDKConstants.BONDORDER_SINGLE)); assertTrue(UniversalIsomorphismTester.isSubgraph(c,query)); } catch (CDKException x) { fail(); } } </code> Regards, Nina Jeliazkova -- ------------------------------------------------------------------ Assoc. Prof. Dr. Nina Nikolova-Jeliazkova * * Institute for Parallel Processing * * Bulgarian Academy of Sciences * IST Foundation * Acad. G. Bonchev St 25-A * The Bulgarian NREN * 1113 Sofia, Bulgaria * * Tel: +3592 9796616 * * ICQ: 10705013 http://www.ist.bg www: http://ambit.acad.bg/nina ------------------------------------------------------------------ PGP Public Key http://cert.acad.bg/pgp-keys/keys/nina-nikolova-0xEEABA669.asc 8E99 8BAD D804 1A43 27B7 7F87 CF04 C7D1 EEAB A669 ------------------------------------------------------------------ |