@Test public void ShouldGetOptionsFromHarmonicLoopAndChord() { HarmonicLoop loop = new HarmonicLoop(); List<HiveChord> loopsChords = new ArrayList<HiveChord>() {{ add(new HiveChord("c#_maj")); }}; loop.setChords(loopsChords); HiveChord chord = new HiveChord("a_dom_7"); List<HarmonicLoop> options = harmonicLoopOptions.getLoopOptionsFromHarmonicLoopAndChord(loop, chord, sourceData.getHarmonicLoops(0)); Assert.assertEquals(2, options.size()); Assert.assertEquals(3, options.get(0).getId().intValue()); Assert.assertEquals(2, options.get(1).getId().intValue()); }
@Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> options = new ArrayList<>(); List<HarmonicLoop> optionsFromHarmonicLoop = getLoopOptionsFromHarmonicLoop(harmonicLoop, harmonicLoopOptions); List<HarmonicLoop> optionsFromChords = getLoopOptionsFromAChord(chord, harmonicLoopOptions); options.addAll(optionsFromHarmonicLoop); for (HarmonicLoop option : optionsFromChords) { boolean exisits = optionsFromHarmonicLoop.stream().anyMatch(l -> l.getId().equals(option.getId())); if (!exisits) { options.add(option); } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(options); return clonedOptions; }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> options = new ArrayList<>(); List<HarmonicLoop> optionsFromHarmonicLoop = getLoopOptionsFromHarmonicLoop(harmonicLoop, harmonicLoopOptions); List<HarmonicLoop> optionsFromChords = getLoopOptionsFromAChord(chord, harmonicLoopOptions); options.addAll(optionsFromHarmonicLoop); for (HarmonicLoop option : optionsFromChords) { boolean exisits = optionsFromHarmonicLoop.stream().anyMatch(l -> l.getId().equals(option.getId())); if (!exisits) { options.add(option); } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(options); return clonedOptions; } }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> options = new ArrayList<>(); List<HarmonicLoop> optionsFromHarmonicLoop = getLoopOptionsFromHarmonicLoop(harmonicLoop, harmonicLoopOptions); List<HarmonicLoop> optionsFromChords = getLoopOptionsFromAChord(chord, harmonicLoopOptions); options.addAll(optionsFromHarmonicLoop); for (HarmonicLoop option : optionsFromChords) { boolean exisits = optionsFromHarmonicLoop.stream().anyMatch(l -> l.getId().equals(option.getId())); if (!exisits) { options.add(option); } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(options); return clonedOptions; } @Autowired  HarmonicLoopOptions(OptionsFilter optionsFilter); }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> options = new ArrayList<>(); List<HarmonicLoop> optionsFromHarmonicLoop = getLoopOptionsFromHarmonicLoop(harmonicLoop, harmonicLoopOptions); List<HarmonicLoop> optionsFromChords = getLoopOptionsFromAChord(chord, harmonicLoopOptions); options.addAll(optionsFromHarmonicLoop); for (HarmonicLoop option : optionsFromChords) { boolean exisits = optionsFromHarmonicLoop.stream().anyMatch(l -> l.getId().equals(option.getId())); if (!exisits) { options.add(option); } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(options); return clonedOptions; } @Autowired  HarmonicLoopOptions(OptionsFilter optionsFilter); @Override void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions); @Override void setHarmonicLoopOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions, ProcessingState processingState); @Override List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions); @Override List<HarmonicLoop> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions); @Override List<HarmonicLoop> getLoopOptionsFromAChord(HiveChord chord, List<HarmonicLoop> harmonicLoopOptions); }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> options = new ArrayList<>(); List<HarmonicLoop> optionsFromHarmonicLoop = getLoopOptionsFromHarmonicLoop(harmonicLoop, harmonicLoopOptions); List<HarmonicLoop> optionsFromChords = getLoopOptionsFromAChord(chord, harmonicLoopOptions); options.addAll(optionsFromHarmonicLoop); for (HarmonicLoop option : optionsFromChords) { boolean exisits = optionsFromHarmonicLoop.stream().anyMatch(l -> l.getId().equals(option.getId())); if (!exisits) { options.add(option); } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(options); return clonedOptions; } @Autowired  HarmonicLoopOptions(OptionsFilter optionsFilter); @Override void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions); @Override void setHarmonicLoopOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions, ProcessingState processingState); @Override List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions); @Override List<HarmonicLoop> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions); @Override List<HarmonicLoop> getLoopOptionsFromAChord(HiveChord chord, List<HarmonicLoop> harmonicLoopOptions);  }