@Test public void shouldSet2nd3rd4thChords(){ ProgressionUnit progressionUnitOne = new ProgressionUnit(); progressionUnitOne.setType(ProgressionUnit.ProgressionType.VERSE); progressionUnitOne.initBars(4); ProgressionUnit progressionUnitTwo = new ProgressionUnit(); progressionUnitTwo.setType(ProgressionUnit.ProgressionType.BRIDGE); progressionUnitTwo.initBars(4); ProgressionUnit progressionUnitThree = new ProgressionUnit(); progressionUnitThree.setType(ProgressionUnit.ProgressionType.CHORUS); progressionUnitThree.initBars(4); List<ProgressionUnit> progressionUnits = Arrays.asList(progressionUnitOne,progressionUnitTwo,progressionUnitThree); HashMap<ProgressionUnit.ProgressionType, List<HiveChord>> typeToChordsMap = new HashMap<>(); typeToChordsMap.put(ProgressionUnit.ProgressionType.VERSE, Arrays.asList(new HiveChord("cmin"),new HiveChord("dmin"),new HiveChord("emin"),new HiveChord("fmin"))); typeToChordsMap.put(ProgressionUnit.ProgressionType.BRIDGE, Arrays.asList(new HiveChord("amaj"),new HiveChord("bmaj"),new HiveChord("cmaj"),new HiveChord("dmaj"))); typeToChordsMap.put(ProgressionUnit.ProgressionType.CHORUS, Arrays.asList(new HiveChord("ddom7"),new HiveChord("edom7"),new HiveChord("fdom7"),new HiveChord("gdom7"))); chordStructureGenerator.set2nd3rd4thChordsFor4BarLoops(progressionUnits, typeToChordsMap); assertThat(progressionUnits.size()).isEqualTo(3); for(ProgressionUnit progressionUnit : progressionUnits){ List<ProgressionUnitBar> bars = progressionUnit.getProgressionUnitBars(); if(progressionUnit.getType().equals(ProgressionUnit.ProgressionType.VERSE)){ assertThat(bars.get(0).getChord().isEqual(new HiveChord("cmin"))).isTrue(); assertThat(bars.get(1).getChord().isEqual(new HiveChord("dmin"))).isTrue(); assertThat(bars.get(2).getChord().isEqual(new HiveChord("emin"))).isTrue(); assertThat(bars.get(3).getChord().isEqual(new HiveChord("fmin"))).isTrue(); } if(progressionUnit.getType().equals(ProgressionUnit.ProgressionType.BRIDGE)){ assertThat(bars.get(0).getChord().isEqual(new HiveChord("amaj"))).isTrue(); assertThat(bars.get(1).getChord().isEqual(new HiveChord("bmaj"))).isTrue(); assertThat(bars.get(2).getChord().isEqual(new HiveChord("cmaj"))).isTrue(); assertThat(bars.get(3).getChord().isEqual(new HiveChord("dmaj"))).isTrue(); } if(progressionUnit.getType().equals(ProgressionUnit.ProgressionType.CHORUS)){ assertThat(bars.get(0).getChord().isEqual(new HiveChord("ddom7"))).isTrue(); assertThat(bars.get(1).getChord().isEqual(new HiveChord("edom7"))).isTrue(); assertThat(bars.get(2).getChord().isEqual(new HiveChord("fdom7"))).isTrue(); assertThat(bars.get(3).getChord().isEqual(new HiveChord("gdom7"))).isTrue(); } } }
public boolean set2nd3rd4thChordsFor4BarLoops(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, List<HiveChord>> progressionTypeListHashMap) { for (ProgressionUnit progressionUnit : progressionUnits) { List<HiveChord> hiveChords = progressionTypeListHashMap.get(progressionUnit.getType()); progressionUnit.getProgressionUnitBars().get(0).setChord(hiveChords.get(0)); progressionUnit.getProgressionUnitBars().get(1).setChord(hiveChords.get(1)); progressionUnit.getProgressionUnitBars().get(2).setChord(hiveChords.get(2)); progressionUnit.getProgressionUnitBars().get(3).setChord(hiveChords.get(3)); } return true; }
ChordStructureGenerator implements IChordStructureGenerator { public boolean set2nd3rd4thChordsFor4BarLoops(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, List<HiveChord>> progressionTypeListHashMap) { for (ProgressionUnit progressionUnit : progressionUnits) { List<HiveChord> hiveChords = progressionTypeListHashMap.get(progressionUnit.getType()); progressionUnit.getProgressionUnitBars().get(0).setChord(hiveChords.get(0)); progressionUnit.getProgressionUnitBars().get(1).setChord(hiveChords.get(1)); progressionUnit.getProgressionUnitBars().get(2).setChord(hiveChords.get(2)); progressionUnit.getProgressionUnitBars().get(3).setChord(hiveChords.get(3)); } return true; } }
ChordStructureGenerator implements IChordStructureGenerator { public boolean set2nd3rd4thChordsFor4BarLoops(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, List<HiveChord>> progressionTypeListHashMap) { for (ProgressionUnit progressionUnit : progressionUnits) { List<HiveChord> hiveChords = progressionTypeListHashMap.get(progressionUnit.getType()); progressionUnit.getProgressionUnitBars().get(0).setChord(hiveChords.get(0)); progressionUnit.getProgressionUnitBars().get(1).setChord(hiveChords.get(1)); progressionUnit.getProgressionUnitBars().get(2).setChord(hiveChords.get(2)); progressionUnit.getProgressionUnitBars().get(3).setChord(hiveChords.get(3)); } return true; }  }
ChordStructureGenerator implements IChordStructureGenerator { public boolean set2nd3rd4thChordsFor4BarLoops(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, List<HiveChord>> progressionTypeListHashMap) { for (ProgressionUnit progressionUnit : progressionUnits) { List<HiveChord> hiveChords = progressionTypeListHashMap.get(progressionUnit.getType()); progressionUnit.getProgressionUnitBars().get(0).setChord(hiveChords.get(0)); progressionUnit.getProgressionUnitBars().get(1).setChord(hiveChords.get(1)); progressionUnit.getProgressionUnitBars().get(2).setChord(hiveChords.get(2)); progressionUnit.getProgressionUnitBars().get(3).setChord(hiveChords.get(3)); } 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 set2nd3rd4thChordsFor4BarLoops(List<ProgressionUnit> progressionUnits, HashMap<ProgressionType, List<HiveChord>> progressionTypeListHashMap) { for (ProgressionUnit progressionUnit : progressionUnits) { List<HiveChord> hiveChords = progressionTypeListHashMap.get(progressionUnit.getType()); progressionUnit.getProgressionUnitBars().get(0).setChord(hiveChords.get(0)); progressionUnit.getProgressionUnitBars().get(1).setChord(hiveChords.get(1)); progressionUnit.getProgressionUnitBars().get(2).setChord(hiveChords.get(2)); progressionUnit.getProgressionUnitBars().get(3).setChord(hiveChords.get(3)); } 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);  }