@Test public void ShouldGetOptionsFromHarmonicLoop() { HarmonicLoop loop = new HarmonicLoop(); List<HiveChord> loopsChords = new ArrayList<HiveChord>() {{ add(new HiveChord("c_maj")); add(new HiveChord("c#_maj")); add(new HiveChord("d_dom_7")); }}; loop.setChords(loopsChords); List<HarmonicLoop> options = harmonicLoopOptions.getLoopOptionsFromHarmonicLoop(loop, sourceData.getHarmonicLoops(0)); Assert.assertEquals(2, options.size()); Assert.assertEquals(3, options.get(0).getId().intValue()); Assert.assertEquals(1, options.get(1).getId().intValue()); }
@Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> loopOptions = new ArrayList<>(); if (harmonicLoop.getValidChords() != null && harmonicLoop.getValidChords().size() > 0) { for (HiveChord chord : harmonicLoop.getValidChords()) { for (HarmonicLoop loop : harmonicLoopOptions) { boolean exisits = loopOptions.stream().anyMatch(l -> l.getId().equals(loop.getId())); if (chord.hasMatchingRoot(loop) && !loopOptions.contains(loop)) { loopOptions.add(loop); } } } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(loopOptions); return clonedOptions; }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> loopOptions = new ArrayList<>(); if (harmonicLoop.getValidChords() != null && harmonicLoop.getValidChords().size() > 0) { for (HiveChord chord : harmonicLoop.getValidChords()) { for (HarmonicLoop loop : harmonicLoopOptions) { boolean exisits = loopOptions.stream().anyMatch(l -> l.getId().equals(loop.getId())); if (chord.hasMatchingRoot(loop) && !loopOptions.contains(loop)) { loopOptions.add(loop); } } } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(loopOptions); return clonedOptions; } }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> loopOptions = new ArrayList<>(); if (harmonicLoop.getValidChords() != null && harmonicLoop.getValidChords().size() > 0) { for (HiveChord chord : harmonicLoop.getValidChords()) { for (HarmonicLoop loop : harmonicLoopOptions) { boolean exisits = loopOptions.stream().anyMatch(l -> l.getId().equals(loop.getId())); if (chord.hasMatchingRoot(loop) && !loopOptions.contains(loop)) { loopOptions.add(loop); } } } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(loopOptions); return clonedOptions; } @Autowired  HarmonicLoopOptions(OptionsFilter optionsFilter); }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public List<HarmonicLoop> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> loopOptions = new ArrayList<>(); if (harmonicLoop.getValidChords() != null && harmonicLoop.getValidChords().size() > 0) { for (HiveChord chord : harmonicLoop.getValidChords()) { for (HarmonicLoop loop : harmonicLoopOptions) { boolean exisits = loopOptions.stream().anyMatch(l -> l.getId().equals(loop.getId())); if (chord.hasMatchingRoot(loop) && !loopOptions.contains(loop)) { loopOptions.add(loop); } } } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(loopOptions); 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> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> loopOptions = new ArrayList<>(); if (harmonicLoop.getValidChords() != null && harmonicLoop.getValidChords().size() > 0) { for (HiveChord chord : harmonicLoop.getValidChords()) { for (HarmonicLoop loop : harmonicLoopOptions) { boolean exisits = loopOptions.stream().anyMatch(l -> l.getId().equals(loop.getId())); if (chord.hasMatchingRoot(loop) && !loopOptions.contains(loop)) { loopOptions.add(loop); } } } } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(loopOptions); 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);  }