@Test public void selectsCorrectChordBetweenTwoChords() { List<HiveChord> hiveChordInDatabase = Arrays.asList(new HiveChord("cMAJ7"), new HiveChord("a#Min7"), new HiveChord("dDom7"), new HiveChord("d#Maj7"), new HiveChord("a#Min7"), new HiveChord("a#Min7"), new HiveChord("_"), new HiveChord("d#Maj7"), new HiveChord("a#Min7"), new HiveChord("a#Min7"), new HiveChord("_"), new HiveChord("_"), new HiveChord("d#Maj7"), new HiveChord("a#Min7"), new HiveChord("a#Min7"), new HiveChord("a#Min7"), new HiveChord("dDom7"), new HiveChord("d#Maj7"), new HiveChord("a#Min7")); HiveChord selectedChord1 = chordSelector.selectChordBetweenChords(new HiveChord("a#Min7"), new HiveChord("d#Maj7"), hiveChordInDatabase); HiveChord selectedChord2 = chordSelector.selectChordBetweenChords(new HiveChord("a#Min7"), new HiveChord("d#Maj7"), hiveChordInDatabase); HiveChord selectedChord3 = chordSelector.selectChordBetweenChords(new HiveChord("a#Min7"), new HiveChord("d#Maj7"), hiveChordInDatabase); HiveChord selectedChord4 = chordSelector.selectChordBetweenChords(new HiveChord("a#Min7"), new HiveChord("d#Maj7"), hiveChordInDatabase); assertThat(selectedChord1.getChordName()).isEqualTo("ddom7"); assertThat(selectedChord2.getChordName()).isEqualTo("ddom7"); assertThat(selectedChord3.getChordName()).isEqualTo("ddom7"); assertThat(selectedChord4.getChordName()).isEqualTo("ddom7"); }
public HiveChord selectChordBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase) { List<HiveChord> candidates = getChordCandidatesBetweenChords(chordOne, chordTwo, hiveChordInDatabase); if (candidates == null || candidates.size() == 0) { return null; } if (candidates.size() == 0) { candidates.add(chordOne); } int max = candidates.size(); int randomIndex = new Random().nextInt(max); return candidates.get(randomIndex); }
ChordSelector implements IChordSelector { public HiveChord selectChordBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase) { List<HiveChord> candidates = getChordCandidatesBetweenChords(chordOne, chordTwo, hiveChordInDatabase); if (candidates == null || candidates.size() == 0) { return null; } if (candidates.size() == 0) { candidates.add(chordOne); } int max = candidates.size(); int randomIndex = new Random().nextInt(max); return candidates.get(randomIndex); } }
ChordSelector implements IChordSelector { public HiveChord selectChordBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase) { List<HiveChord> candidates = getChordCandidatesBetweenChords(chordOne, chordTwo, hiveChordInDatabase); if (candidates == null || candidates.size() == 0) { return null; } if (candidates.size() == 0) { candidates.add(chordOne); } int max = candidates.size(); int randomIndex = new Random().nextInt(max); return candidates.get(randomIndex); }  }
ChordSelector implements IChordSelector { public HiveChord selectChordBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase) { List<HiveChord> candidates = getChordCandidatesBetweenChords(chordOne, chordTwo, hiveChordInDatabase); if (candidates == null || candidates.size() == 0) { return null; } if (candidates.size() == 0) { candidates.add(chordOne); } int max = candidates.size(); int randomIndex = new Random().nextInt(max); return candidates.get(randomIndex); }  HashMap<ProgressionType, HiveChord> selectFirstChordForType(List<ProgressionType> progressionTypes, List<HiveChord> hiveChordInDatabase); @Override HashMap<ProgressionType, List<HiveChord>> selectChordsFrom4BarLoop(List<ProgressionUnit> progressionUnits); HiveChord tempRandomChordSelect(List<HiveChord> getHiveChordInDatabase); HiveChord getChordTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase); List<HiveChord> getChordCandidatesTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase); HiveChord selectChordBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase); @Override HiveChord selectChordBetweenChordsAndLoop(HiveChord chordOne, HiveChord chordTwo, HarmonicLoop harmonicLoop, List<HiveChord> hiveChordInDatabase); List<HiveChord> getChordCandidatesBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase); @Override HiveChord selectMiddleChord(HarmonicLoop selectedLoop, HiveChord chordOneOfFour, HiveChord chordOneOfNextBar, List<HiveChord> hiveChordInDatabase); @Override HiveChord selectFourthChord(HarmonicLoop selectedLoop, HiveChord thirdChord, HiveChord nextChord, List<HiveChord> hiveChordInDatabase); }
ChordSelector implements IChordSelector { public HiveChord selectChordBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase) { List<HiveChord> candidates = getChordCandidatesBetweenChords(chordOne, chordTwo, hiveChordInDatabase); if (candidates == null || candidates.size() == 0) { return null; } if (candidates.size() == 0) { candidates.add(chordOne); } int max = candidates.size(); int randomIndex = new Random().nextInt(max); return candidates.get(randomIndex); }  HashMap<ProgressionType, HiveChord> selectFirstChordForType(List<ProgressionType> progressionTypes, List<HiveChord> hiveChordInDatabase); @Override HashMap<ProgressionType, List<HiveChord>> selectChordsFrom4BarLoop(List<ProgressionUnit> progressionUnits); HiveChord tempRandomChordSelect(List<HiveChord> getHiveChordInDatabase); HiveChord getChordTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase); List<HiveChord> getChordCandidatesTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase); HiveChord selectChordBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase); @Override HiveChord selectChordBetweenChordsAndLoop(HiveChord chordOne, HiveChord chordTwo, HarmonicLoop harmonicLoop, List<HiveChord> hiveChordInDatabase); List<HiveChord> getChordCandidatesBetweenChords(HiveChord chordOne, HiveChord chordTwo, List<HiveChord> hiveChordInDatabase); @Override HiveChord selectMiddleChord(HarmonicLoop selectedLoop, HiveChord chordOneOfFour, HiveChord chordOneOfNextBar, List<HiveChord> hiveChordInDatabase); @Override HiveChord selectFourthChord(HarmonicLoop selectedLoop, HiveChord thirdChord, HiveChord nextChord, List<HiveChord> hiveChordInDatabase);  }