@Test public void getsListOfChordsTwoBarsPrior() { List<HiveChord> hiveChordInDatabase = Arrays.asList(new HiveChord("dDom7"), new HiveChord("cMAJ7"), new HiveChord("a#Min7"), new HiveChord("dDom7"), new HiveChord("d#Maj7") , new HiveChord("f#Min7"), new HiveChord("_"), new HiveChord("dDom7") , new HiveChord("_"), new HiveChord("a#Min7"), new HiveChord("dDom7") , new HiveChord("a#Min7"), new HiveChord("a#Min7"), new HiveChord("dDom7"), new HiveChord("d#Maj7"), new HiveChord("a#Min7")); List<HiveChord> selectedChord = chordSelector.getChordCandidatesTwoBarsPrior(new HiveChord("dDom7"), hiveChordInDatabase); assertThat(2).isEqualTo(selectedChord.size()); assertThat(selectedChord.get(0).isEqual("cMAJ7")).isTrue(); assertThat(selectedChord.get(1).isEqual("a#Min7")).isTrue(); }
public List<HiveChord> getChordCandidatesTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase) { List<HiveChord> chordCandidates = new ArrayList<HiveChord>(); for (int i = 0; i < hiveChordInDatabase.size(); i++) { if (i > 1 && hiveChordInDatabase.get(i).isEqual(currentChord)) { if (!hiveChordInDatabase.get(i - 2).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK) && !hiveChordInDatabase.get(i - 1).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK)) { chordCandidates.add(hiveChordInDatabase.get(i - 2)); } } } if (chordCandidates == null || chordCandidates.size() == 0) { return null; } return chordCandidates; }
ChordSelector implements IChordSelector { public List<HiveChord> getChordCandidatesTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase) { List<HiveChord> chordCandidates = new ArrayList<HiveChord>(); for (int i = 0; i < hiveChordInDatabase.size(); i++) { if (i > 1 && hiveChordInDatabase.get(i).isEqual(currentChord)) { if (!hiveChordInDatabase.get(i - 2).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK) && !hiveChordInDatabase.get(i - 1).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK)) { chordCandidates.add(hiveChordInDatabase.get(i - 2)); } } } if (chordCandidates == null || chordCandidates.size() == 0) { return null; } return chordCandidates; } }
ChordSelector implements IChordSelector { public List<HiveChord> getChordCandidatesTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase) { List<HiveChord> chordCandidates = new ArrayList<HiveChord>(); for (int i = 0; i < hiveChordInDatabase.size(); i++) { if (i > 1 && hiveChordInDatabase.get(i).isEqual(currentChord)) { if (!hiveChordInDatabase.get(i - 2).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK) && !hiveChordInDatabase.get(i - 1).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK)) { chordCandidates.add(hiveChordInDatabase.get(i - 2)); } } } if (chordCandidates == null || chordCandidates.size() == 0) { return null; } return chordCandidates; }  }
ChordSelector implements IChordSelector { public List<HiveChord> getChordCandidatesTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase) { List<HiveChord> chordCandidates = new ArrayList<HiveChord>(); for (int i = 0; i < hiveChordInDatabase.size(); i++) { if (i > 1 && hiveChordInDatabase.get(i).isEqual(currentChord)) { if (!hiveChordInDatabase.get(i - 2).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK) && !hiveChordInDatabase.get(i - 1).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK)) { chordCandidates.add(hiveChordInDatabase.get(i - 2)); } } } if (chordCandidates == null || chordCandidates.size() == 0) { return null; } return chordCandidates; }  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 List<HiveChord> getChordCandidatesTwoBarsPrior(HiveChord currentChord, List<HiveChord> hiveChordInDatabase) { List<HiveChord> chordCandidates = new ArrayList<HiveChord>(); for (int i = 0; i < hiveChordInDatabase.size(); i++) { if (i > 1 && hiveChordInDatabase.get(i).isEqual(currentChord)) { if (!hiveChordInDatabase.get(i - 2).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK) && !hiveChordInDatabase.get(i - 1).getChordName().equalsIgnoreCase(appConfigs.CHORD_BREAK)) { chordCandidates.add(hiveChordInDatabase.get(i - 2)); } } } if (chordCandidates == null || chordCandidates.size() == 0) { return null; } return chordCandidates; }  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);  }