SMARTSQueryTool { public boolean matches(IAtomContainer atomContainer) throws CDKException { return matches(atomContainer, false); } SMARTSQueryTool(String smarts, IChemObjectBuilder builder); void setQueryCacheSize(int maxEntries); void useSmallestSetOfSmallestRings(); void useRelevantRings(); void useEssentialRings(); void setAromaticity(Aromaticity aromaticity); String getSmarts(); void setSmarts(String smarts); boolean matches(IAtomContainer atomContainer); boolean matches(IAtomContainer atomContainer, boolean forceInitialization); int countMatches(); List<List<Integer>> getMatchingAtoms(); List<List<Integer>> getUniqueMatchingAtoms();  }
@Test public void testIndoleAgainstItself() throws Exception { IAtomContainer indole = TestMoleculeFactory.makeIndole(); addImplicitHydrogens(indole); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(indole); Aromaticity.cdkLegacy().apply(indole); SmilesGenerator generator = new SmilesGenerator().aromatic(); String indoleSmiles = generator.create(indole); SmilesParser smilesParser = new SmilesParser(DefaultChemObjectBuilder.getInstance()); indole = smilesParser.parseSmiles(indoleSmiles); SMARTSQueryTool querytool = new SMARTSQueryTool(indoleSmiles, DefaultChemObjectBuilder.getInstance()); assertTrue(querytool.matches(indole)); }
@Test public void testMethane() throws Exception { IAtomContainer methane = SilentChemObjectBuilder.getInstance().newInstance(IAtomContainer.class); IAtom carbon = methane.getBuilder().newInstance(IAtom.class, Elements.CARBON); carbon.setImplicitHydrogenCount(4); methane.addAtom(carbon); SMARTSQueryTool sqt = new SMARTSQueryTool("CC", DefaultChemObjectBuilder.getInstance()); boolean matches = sqt.matches(methane); assertFalse(matches); }