CDKRMapHandler { public void calculateOverlapsAndReduceExactMatch(IAtomContainer molecule1, IAtomContainer molecule2, boolean shouldMatchBonds) throws CDKException { setSource(molecule1); setTarget(molecule2); setMappings(new ArrayList<Map<Integer, Integer>>()); if ((getSource().getAtomCount() == 1) || (getTarget().getAtomCount() == 1)) { List<CDKRMap> overlaps = CDKMCS.checkSingleAtomCases(getSource(), getTarget()); int nAtomsMatched = overlaps.size(); nAtomsMatched = (nAtomsMatched > 0) ? 1 : 0; if (nAtomsMatched > 0) { identifySingleAtomsMatchedParts(overlaps, getSource(), getTarget()); } } else { List<List<CDKRMap>> overlaps = CDKMCS.search(getSource(), getTarget(), new BitSet(), new BitSet(), true, true, shouldMatchBonds); List<List<CDKRMap>> reducedList = removeSubGraph(overlaps); Stack<List<CDKRMap>> allMaxOverlaps = getAllMaximum(reducedList); while (!allMaxOverlaps.empty()) { List<List<CDKRMap>> maxOverlapsAtoms = makeAtomsMapOfBondsMap(allMaxOverlaps.peek(), getSource(), getTarget()); identifyMatchedParts(maxOverlapsAtoms, getSource(), getTarget()); allMaxOverlaps.pop(); } } FinalMappings.getInstance().set(getMappings()); } CDKRMapHandler(); IAtomContainer getSource(); void setSource(IAtomContainer aSource); IAtomContainer getTarget(); void setTarget(IAtomContainer aTarget); void calculateOverlapsAndReduce(IAtomContainer molecule1, IAtomContainer molecule2, boolean shouldMatchBonds); void calculateOverlapsAndReduceExactMatch(IAtomContainer molecule1, IAtomContainer molecule2,
            boolean shouldMatchBonds); void calculateSubGraphs(IAtomContainer molecule1, IAtomContainer molecule2, boolean shouldMatchBonds); void calculateIsomorphs(IAtomContainer molecule1, IAtomContainer molecule2, boolean shouldMatchBonds); List<Map<Integer, Integer>> getMappings(); void setMappings(List<Map<Integer, Integer>> mappings); boolean isTimeoutFlag(); void setTimeoutFlag(boolean timeoutFlag);  }
@Test public void testCalculateOverlapsAndReduceExactMatch() throws Exception { IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance(); SmilesParser sp = new SmilesParser(builder); IAtomContainer Molecule1 = sp.parseSmiles("O1C=CC=C1"); IAtomContainer Molecule2 = sp.parseSmiles("O1C=CC=C1"); CDKRMapHandler instance = new CDKRMapHandler(); instance.calculateOverlapsAndReduceExactMatch(Molecule1, Molecule2, true); Assert.assertNotNull(FinalMappings.getInstance().getSize()); }