### Question:
ChemicalFilters extends BaseFilter { public synchronized void sortResultsByFragments() { Map<Integer, AtomAtomMapping> allFragmentAtomMCS = Collections.synchronizedSortedMap(new TreeMap<>()); Map<Integer, Double> stereoScoreMap = Collections.synchronizedSortedMap(new TreeMap<>()); Map<Integer, Double> energyScoreMap = Collections.synchronizedSortedMap(new TreeMap<>()); Map<Integer, Integer> fragmentScoreMap = Collections.synchronizedSortedMap(new TreeMap<>()); initializeMaps( allFragmentAtomMCS, stereoScoreMap, fragmentScoreMap, energyScoreMap); try { int minFragmentScore = fragmentFilter.sortResults(allFragmentAtomMCS, fragmentScoreMap); boolean flag = false; if (minFragmentScore < 9999) { flag = true; clear(); } int counter = 0; for (Map.Entry<Integer, Integer> map : fragmentScoreMap.entrySet()) { if (minFragmentScore == map.getValue()) { addSolution(counter, map.getKey(), allFragmentAtomMCS, stereoScoreMap, energyScoreMap, fragmentScoreMap); counter++; } } if (flag) { clear(allFragmentAtomMCS, stereoScoreMap, fragmentScoreMap, energyScoreMap); } } catch (CDKException c) { } } ChemicalFilters(
            IAtomContainer sourceMol,
            IAtomContainer targetMol);  ChemicalFilters(
            IQueryAtomContainer sourceMol,
            IAtomContainer targetMol); synchronized void sortResultsByEnergies(); synchronized void sortResultsByFragments(); synchronized void sortResultsByStereoAndBondMatch(); synchronized List<Double> getSortedEnergy(); synchronized List<Integer> getSortedFragment(); synchronized List<Double> getStereoMatches();  }### Answer:
@Test public void testSortResultsByFragments() throws InvalidSmilesException, CDKException { SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer target = sp.parseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C"); IAtomContainer queryac = sp.parseSmiles("Nc1ccccc1"); Isomorphism smsd = new Isomorphism(queryac, target, Algorithm.CDKMCS, false, false, false); smsd.setChemFilters(false, false, false); assertEquals(4, smsd.getAllAtomMapping().size()); Isomorphism smsd1 = new Isomorphism(queryac, target, Algorithm.CDKMCS, false, false, false); smsd1.setChemFilters(false, true, false); assertEquals(2, smsd1.getAllAtomMapping().size()); }