TemplateHandler { public IAtomContainer removeMolecule(IAtomContainer molecule) throws CDKException { for (int i = 0; i < templates.size(); i++) { if (VentoFoggia.findIdentical(templates.get(i), anonAtomMatcher, anonBondMatcher) .matches(molecule)) { elemPatterns.remove(i); anonPatterns.remove(i); return templates.remove(i); } } return null; } TemplateHandler(IChemObjectBuilder builder);  TemplateHandler(); void loadTemplates(IChemObjectBuilder builder); void addMolecule(IAtomContainer molecule); IAtomContainer removeMolecule(IAtomContainer molecule); boolean mapTemplateExact(IAtomContainer molecule); boolean mapTemplates(IAtomContainer molecule); int getTemplateCount(); IAtomContainer getTemplateAt(int position); IAtomContainerSet getMappedSubstructures(IAtomContainer molecule); static TemplateHandler createSingleton(IAtomContainer template); static TemplateHandler createFromSubstructure(Pattern ptrn, Iterable<IAtomContainer> mols); static TemplateHandler createFromSubstructure(Pattern ptrn, IAtomContainer mol);  }
@Test public void testRemoveMolecule() throws Exception { logger.debug("***TestRemoveMolecule***"); boolean itIsInThere = false; TemplateHandler th = new TemplateHandler(DefaultChemObjectBuilder.getInstance()); IAtomContainer mol = TestMoleculeFactory.makeAlphaPinene(); sdg.setMolecule(mol); sdg.generateCoordinates(); mol = sdg.getMolecule(); String smiles = "C1=C(C)C2CC(C1)C2(C)(C)"; IAtomContainer smilesMol = sp.parseSmiles(smiles); itIsInThere = th.mapTemplates(smilesMol); logger.debug("Alpha-Pinene found by templateMapper: " + itIsInThere); Assert.assertFalse(itIsInThere); th.addMolecule(mol); logger.debug("now adding template for alpha-Pinen and trying again."); itIsInThere = th.mapTemplates(smilesMol); logger.debug("Alpha-Pinene found by templateMapper: " + itIsInThere); Assert.assertTrue(itIsInThere); logger.debug("now removing template for alpha-Pinen again and trying again."); th.removeMolecule(mol); itIsInThere = th.mapTemplates(smilesMol); logger.debug("Alpha-Pinene found by templateMapper: " + itIsInThere); Assert.assertFalse(itIsInThere); }