class SetMelodicSynthEvent implements IEventChain {

    public List<BachChorale> createMatchingChorales(List<BachChorale> bachChorales, List<HarmonyExtraction> harmonyExtractions) {

        List<BachChorale> matchingChorales = new ArrayList<>();
        List<HarmonyExtraction> remainingExtractions = harmonyExtractions;

        while (matchingChorales.size() < harmonyExtractions.size()){

            LongestMatchResponse longestMatch = getLongestMatch(bachChorales, remainingExtractions);
            if(longestMatch.getMatch().isEmpty()){
                longestMatch.addMatchingChord(null);
                matchingChorales.add(null);
            }else {
                matchingChorales.addAll(longestMatch.getMatch());
            }

            remainingExtractions = remainingExtractions.subList(longestMatch.getMatch().size(), remainingExtractions.size());
        }

        return matchingChorales;
    }

    @Autowired public  SetMelodicSynthEvent(MelodyGenerator melodydGenerator, MelodicExtractor melodicExtractor, IBachChoraleDal bachChoraleDal);

}