@Test public void shouldSetCorrectKey(){ SetKeyEvent setKeyEvent = new SetKeyEvent(); queueState = setKeyEvent.set(queueState); ProgressionUnit pUOne = queueState.getStructure().get(0); ProgressionUnit pUTwo = queueState.getStructure().get(1); assert(pUOne.getKey()).equalsIgnoreCase("c"); assert(pUTwo.getKey()).equalsIgnoreCase("g"); }
@Override public QueueState set(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { List<String> unitChords = new ArrayList<>(); for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { unitChords.add(pBar.getChord().getRawChordName()); } String key = keyExtractor.extract(unitChords); pUnit.setKey(key); } return queueState; }
SetKeyEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { List<String> unitChords = new ArrayList<>(); for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { unitChords.add(pBar.getChord().getRawChordName()); } String key = keyExtractor.extract(unitChords); pUnit.setKey(key); } return queueState; } }
SetKeyEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { List<String> unitChords = new ArrayList<>(); for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { unitChords.add(pBar.getChord().getRawChordName()); } String key = keyExtractor.extract(unitChords); pUnit.setKey(key); } return queueState; } SetKeyEvent(); }
SetKeyEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { List<String> unitChords = new ArrayList<>(); for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { unitChords.add(pBar.getChord().getRawChordName()); } String key = keyExtractor.extract(unitChords); pUnit.setKey(key); } return queueState; } SetKeyEvent(); @Override QueueState set(QueueState queueState); }
SetKeyEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { List<String> unitChords = new ArrayList<>(); for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { unitChords.add(pBar.getChord().getRawChordName()); } String key = keyExtractor.extract(unitChords); pUnit.setKey(key); } return queueState; } SetKeyEvent(); @Override QueueState set(QueueState queueState);  }