class CDKRMapHandler {

    public void calculateOverlapsAndReduceExactMatch(IAtomContainer molecule1, IAtomContainer molecule2,
            boolean shouldMatchBonds) throws CDKException {

        setSource(molecule1);
        setTarget(molecule2);

        setMappings(new ArrayList<Map<Integer, Integer>>());

        //System.out.println("Searching: ");
        //List overlaps = UniversalIsomorphismTesterBondTypeInSensitive.getSubgraphAtomsMap(source, target);

        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());
    }

    public  CDKRMapHandler();

}