@Test public void ShouldSetMiddleChords() { List<ProgressionUnit> progressionUnits = new ArrayList<>(); ProgressionUnit pUnit = new ProgressionUnit(); pUnit.initBars(FOUR.getValue()); HarmonicLoop loop = new HarmonicLoop(); loop.setChords(new ArrayList<HiveChord>() {{ add(new HiveChord("e_dom7")); add(new HiveChord("e_min7")); add(new HiveChord("d_dom7")); }}); pUnit.getProgressionUnitBars().get(LoopPositions.POSITION_THREE).setHarmonicLoop(loop); progressionUnits.add(pUnit); List<HiveChord> hiveChordInDatabase = new ArrayList<HiveChord>(); hiveChordInDatabase.add(new HiveChord("c_maj7")); hiveChordInDatabase.add(new HiveChord("d_min7")); hiveChordInDatabase.add(new HiveChord("f_maj7")); hiveChordInDatabase.add(new HiveChord("d_dom7")); hiveChordInDatabase.add(new HiveChord("g_maj7")); hiveChordInDatabase.add(new HiveChord("g#_maj")); chordStructureGenerator.setChordThree(progressionUnits, hiveChordInDatabase); System.out.println("NAME : " + progressionUnits.get(0).getProgressionUnitBars().get(2).getChord().getChordName()); HiveChord selectedChord = progressionUnits.get(0).getProgressionUnitBars().get(2).getChord(); assertTrue(selectedChord.isEqual("d_dom7") || selectedChord.isEqual("e_dom7") || selectedChord.isEqual("e_min7")); progressionUnits = new ArrayList<>(); pUnit = new ProgressionUnit(); pUnit.initBars(FOUR.getValue()); loop = new HarmonicLoop(); loop.setChords(new ArrayList<HiveChord>() {{ add(new HiveChord("e_dom7")); add(new HiveChord("e_min7")); add(new HiveChord("d_dom7")); add(new HiveChord("g_maj7")); }}); pUnit.getProgressionUnitBars().get(LoopPositions.POSITION_THREE).setHarmonicLoop(loop); pUnit.getProgressionUnitBars().get(ChordPositions.CHORD_ONE).setChord(new HiveChord("d_dom7")); progressionUnits.add(pUnit); hiveChordInDatabase = new ArrayList<HiveChord>(); hiveChordInDatabase.add(new HiveChord("c_maj7")); hiveChordInDatabase.add(new HiveChord("d_min7")); hiveChordInDatabase.add(new HiveChord("f_maj7")); hiveChordInDatabase.add(new HiveChord("d_dom7")); hiveChordInDatabase.add(new HiveChord("g_maj7")); hiveChordInDatabase.add(new HiveChord("g#_maj")); chordStructureGenerator.setChordThree(progressionUnits, hiveChordInDatabase); System.out.println("NAME : " + progressionUnits.get(0).getProgressionUnitBars().get(2).getChord().getChordName()); selectedChord = progressionUnits.get(0).getProgressionUnitBars().get(2).getChord(); assertTrue(selectedChord.isEqual("g_maj7")); }
public boolean setChordThree(List<ProgressionUnit> progressionUnits, List<HiveChord> hiveChordInDatabase) { for (int i = 0; i < progressionUnits.size(); i++) { HiveChord nextProgressionChord; if (i + 1 == progressionUnits.size()) { nextProgressionChord = progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } else { nextProgressionChord = progressionUnits.get(i + 1).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } HiveChord middleChord = chordSelector.selectMiddleChord(progressionUnits.get(i).getProgressionUnitBars().get(LoopPositions.POSITION_THREE).getHarmonicLoop(), progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(), nextProgressionChord, hiveChordInDatabase); if(middleChord == null || middleChord.getRawChordName().equalsIgnoreCase("_")){ return false; } progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_THREE).setChord(middleChord); } return true; }
ChordStructureGenerator implements IChordStructureGenerator { public boolean setChordThree(List<ProgressionUnit> progressionUnits, List<HiveChord> hiveChordInDatabase) { for (int i = 0; i < progressionUnits.size(); i++) { HiveChord nextProgressionChord; if (i + 1 == progressionUnits.size()) { nextProgressionChord = progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } else { nextProgressionChord = progressionUnits.get(i + 1).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } HiveChord middleChord = chordSelector.selectMiddleChord(progressionUnits.get(i).getProgressionUnitBars().get(LoopPositions.POSITION_THREE).getHarmonicLoop(), progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(), nextProgressionChord, hiveChordInDatabase); if(middleChord == null || middleChord.getRawChordName().equalsIgnoreCase("_")){ return false; } progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_THREE).setChord(middleChord); } return true; } }
ChordStructureGenerator implements IChordStructureGenerator { public boolean setChordThree(List<ProgressionUnit> progressionUnits, List<HiveChord> hiveChordInDatabase) { for (int i = 0; i < progressionUnits.size(); i++) { HiveChord nextProgressionChord; if (i + 1 == progressionUnits.size()) { nextProgressionChord = progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } else { nextProgressionChord = progressionUnits.get(i + 1).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } HiveChord middleChord = chordSelector.selectMiddleChord(progressionUnits.get(i).getProgressionUnitBars().get(LoopPositions.POSITION_THREE).getHarmonicLoop(), progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(), nextProgressionChord, hiveChordInDatabase); if(middleChord == null || middleChord.getRawChordName().equalsIgnoreCase("_")){ return false; } progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_THREE).setChord(middleChord); } return true; }  }
ChordStructureGenerator implements IChordStructureGenerator { public boolean setChordThree(List<ProgressionUnit> progressionUnits, List<HiveChord> hiveChordInDatabase) { for (int i = 0; i < progressionUnits.size(); i++) { HiveChord nextProgressionChord; if (i + 1 == progressionUnits.size()) { nextProgressionChord = progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } else { nextProgressionChord = progressionUnits.get(i + 1).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } HiveChord middleChord = chordSelector.selectMiddleChord(progressionUnits.get(i).getProgressionUnitBars().get(LoopPositions.POSITION_THREE).getHarmonicLoop(), progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(), nextProgressionChord, hiveChordInDatabase); if(middleChord == null || middleChord.getRawChordName().equalsIgnoreCase("_")){ return false; } progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_THREE).setChord(middleChord); } return true; }  List<ProgressionType> getProgressionTypes(QueueItem queueItem); QueueState set(QueueState queueState); boolean setChordThree(List<ProgressionUnit> progressionUnits, List<HiveChord> hiveChordInDatabase); boolean setChordTwo(List<HiveChord> hiveChordInDatabase, List<ProgressionUnit> progressionUnits); boolean setChordFour(List<HiveChord> hiveChordInDatabase, List<ProgressionUnit> progressionUnits); boolean set2nd3rd4thChordsFor4BarLoops(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, List<HiveChord>> progressionTypeListHashMap); boolean setFirstChordInProgressions(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, HiveChord> typeAndFirstChord); }
ChordStructureGenerator implements IChordStructureGenerator { public boolean setChordThree(List<ProgressionUnit> progressionUnits, List<HiveChord> hiveChordInDatabase) { for (int i = 0; i < progressionUnits.size(); i++) { HiveChord nextProgressionChord; if (i + 1 == progressionUnits.size()) { nextProgressionChord = progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } else { nextProgressionChord = progressionUnits.get(i + 1).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(); } HiveChord middleChord = chordSelector.selectMiddleChord(progressionUnits.get(i).getProgressionUnitBars().get(LoopPositions.POSITION_THREE).getHarmonicLoop(), progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_ONE).getChord(), nextProgressionChord, hiveChordInDatabase); if(middleChord == null || middleChord.getRawChordName().equalsIgnoreCase("_")){ return false; } progressionUnits.get(i).getProgressionUnitBars().get(ChordPositions.CHORD_THREE).setChord(middleChord); } return true; }  List<ProgressionType> getProgressionTypes(QueueItem queueItem); QueueState set(QueueState queueState); boolean setChordThree(List<ProgressionUnit> progressionUnits, List<HiveChord> hiveChordInDatabase); boolean setChordTwo(List<HiveChord> hiveChordInDatabase, List<ProgressionUnit> progressionUnits); boolean setChordFour(List<HiveChord> hiveChordInDatabase, List<ProgressionUnit> progressionUnits); boolean set2nd3rd4thChordsFor4BarLoops(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, List<HiveChord>> progressionTypeListHashMap); boolean setFirstChordInProgressions(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, HiveChord> typeAndFirstChord);  }