@Test public void shouldSetHitOptionsWithCompatibleChords(){ queueState = hitGenerator.setHitOptions(queueState); List<ProgressionUnitBar> bars = queueState.getQueueItem().getProgression().getStructure().get(0).getProgressionUnitBars(); assertThat(bars.get(0).getHitOptions().size()).isEqualTo(2); assertThat(bars.get(1).getHitOptions().size()).isEqualTo(2); assertThat(bars.get(2).getHitOptions().size()).isEqualTo(1); }
@Override public QueueState setHitOptions(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()){ List<Hit> hitOptions = new ArrayList<>(); for(Hit hitOption : queueState.getDataSource().getHits(queueState.getQueueItem().getStationId())){ if(hitOption.getCompatibleChord() == null || pBar.getChord().isEqualOrTriadMatch(hitOption.getCompatibleChord())){ try { hitOptions.add(hitOption.clone()); } catch (CloneNotSupportedException e) { Application.logger.debug("LOG:", e); } } } pBar.setHitOptions(hitOptions); } } return queueState; }
HitGenerator implements IHitGenerator { @Override public QueueState setHitOptions(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()){ List<Hit> hitOptions = new ArrayList<>(); for(Hit hitOption : queueState.getDataSource().getHits(queueState.getQueueItem().getStationId())){ if(hitOption.getCompatibleChord() == null || pBar.getChord().isEqualOrTriadMatch(hitOption.getCompatibleChord())){ try { hitOptions.add(hitOption.clone()); } catch (CloneNotSupportedException e) { Application.logger.debug("LOG:", e); } } } pBar.setHitOptions(hitOptions); } } return queueState; } }
HitGenerator implements IHitGenerator { @Override public QueueState setHitOptions(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()){ List<Hit> hitOptions = new ArrayList<>(); for(Hit hitOption : queueState.getDataSource().getHits(queueState.getQueueItem().getStationId())){ if(hitOption.getCompatibleChord() == null || pBar.getChord().isEqualOrTriadMatch(hitOption.getCompatibleChord())){ try { hitOptions.add(hitOption.clone()); } catch (CloneNotSupportedException e) { Application.logger.debug("LOG:", e); } } } pBar.setHitOptions(hitOptions); } } return queueState; }  }
HitGenerator implements IHitGenerator { @Override public QueueState setHitOptions(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()){ List<Hit> hitOptions = new ArrayList<>(); for(Hit hitOption : queueState.getDataSource().getHits(queueState.getQueueItem().getStationId())){ if(hitOption.getCompatibleChord() == null || pBar.getChord().isEqualOrTriadMatch(hitOption.getCompatibleChord())){ try { hitOptions.add(hitOption.clone()); } catch (CloneNotSupportedException e) { Application.logger.debug("LOG:", e); } } } pBar.setHitOptions(hitOptions); } } return queueState; }  @Override QueueState setHitOptions(QueueState queueState); @Override QueueState weightHitOptions(QueueState queueState); @Override QueueState selectHits(QueueState queueState); }
HitGenerator implements IHitGenerator { @Override public QueueState setHitOptions(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for(ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()){ List<Hit> hitOptions = new ArrayList<>(); for(Hit hitOption : queueState.getDataSource().getHits(queueState.getQueueItem().getStationId())){ if(hitOption.getCompatibleChord() == null || pBar.getChord().isEqualOrTriadMatch(hitOption.getCompatibleChord())){ try { hitOptions.add(hitOption.clone()); } catch (CloneNotSupportedException e) { Application.logger.debug("LOG:", e); } } } pBar.setHitOptions(hitOptions); } } return queueState; }  @Override QueueState setHitOptions(QueueState queueState); @Override QueueState weightHitOptions(QueueState queueState); @Override QueueState selectHits(QueueState queueState);  }