@Test public void shouldSetThirdBarWithFillOptions() { QueueState state = fillsGenerator.setFillsOptions(queueState); List<ProgressionUnit> progressionUnits = state.getStructure(); assertThat(progressionUnits.get(0).getProgressionUnitBars().get(2).getFillOptions().size()).isEqualTo(3); assertThat(progressionUnits.get(1).getProgressionUnitBars().get(2).getFillOptions().size()).isEqualTo(3); assertThat(progressionUnits.get(2).getProgressionUnitBars().get(2).getFillOptions().size()).isEqualTo(0); assertThat(progressionUnits.get(3).getProgressionUnitBars().get(2).getFillOptions().size()).isEqualTo(0); assertThat(progressionUnits.get(4).getProgressionUnitBars().get(2).getFillOptions().size()).isEqualTo(3); assertThat(progressionUnits.get(5).getProgressionUnitBars().get(2).getFillOptions().size()).isEqualTo(3); }
@Override public QueueState setFillsOptions(QueueState queueState) { for(Integer i=0; i<queueState.getStructure().size(); i++){ ProgressionType currentType = queueState.getStructure().get(i).getType(); if(nextUnitIsNull(queueState.getStructure(),i) || !queueState.getStructure().get(i+1).getType().equals(currentType)){ List<Fill> filteredFills= new ArrayList<>(); for(Fill fill: queueState.getDataSource().getFills(queueState.getQueueItem().getStationId())){ if(fill.getBarCount().equals(2)) { filteredFills.add(fill); } } queueState.getStructure().get(i).getProgressionUnitBars().get(2).setFillOptions(filteredFills); } } return queueState; }
FillsGenerator implements IFillsGenerator { @Override public QueueState setFillsOptions(QueueState queueState) { for(Integer i=0; i<queueState.getStructure().size(); i++){ ProgressionType currentType = queueState.getStructure().get(i).getType(); if(nextUnitIsNull(queueState.getStructure(),i) || !queueState.getStructure().get(i+1).getType().equals(currentType)){ List<Fill> filteredFills= new ArrayList<>(); for(Fill fill: queueState.getDataSource().getFills(queueState.getQueueItem().getStationId())){ if(fill.getBarCount().equals(2)) { filteredFills.add(fill); } } queueState.getStructure().get(i).getProgressionUnitBars().get(2).setFillOptions(filteredFills); } } return queueState; } }
FillsGenerator implements IFillsGenerator { @Override public QueueState setFillsOptions(QueueState queueState) { for(Integer i=0; i<queueState.getStructure().size(); i++){ ProgressionType currentType = queueState.getStructure().get(i).getType(); if(nextUnitIsNull(queueState.getStructure(),i) || !queueState.getStructure().get(i+1).getType().equals(currentType)){ List<Fill> filteredFills= new ArrayList<>(); for(Fill fill: queueState.getDataSource().getFills(queueState.getQueueItem().getStationId())){ if(fill.getBarCount().equals(2)) { filteredFills.add(fill); } } queueState.getStructure().get(i).getProgressionUnitBars().get(2).setFillOptions(filteredFills); } } return queueState; }  }
FillsGenerator implements IFillsGenerator { @Override public QueueState setFillsOptions(QueueState queueState) { for(Integer i=0; i<queueState.getStructure().size(); i++){ ProgressionType currentType = queueState.getStructure().get(i).getType(); if(nextUnitIsNull(queueState.getStructure(),i) || !queueState.getStructure().get(i+1).getType().equals(currentType)){ List<Fill> filteredFills= new ArrayList<>(); for(Fill fill: queueState.getDataSource().getFills(queueState.getQueueItem().getStationId())){ if(fill.getBarCount().equals(2)) { filteredFills.add(fill); } } queueState.getStructure().get(i).getProgressionUnitBars().get(2).setFillOptions(filteredFills); } } return queueState; }  @Override QueueState setFillsOptions(QueueState queueState); }
FillsGenerator implements IFillsGenerator { @Override public QueueState setFillsOptions(QueueState queueState) { for(Integer i=0; i<queueState.getStructure().size(); i++){ ProgressionType currentType = queueState.getStructure().get(i).getType(); if(nextUnitIsNull(queueState.getStructure(),i) || !queueState.getStructure().get(i+1).getType().equals(currentType)){ List<Fill> filteredFills= new ArrayList<>(); for(Fill fill: queueState.getDataSource().getFills(queueState.getQueueItem().getStationId())){ if(fill.getBarCount().equals(2)) { filteredFills.add(fill); } } queueState.getStructure().get(i).getProgressionUnitBars().get(2).setFillOptions(filteredFills); } } return queueState; }  @Override QueueState setFillsOptions(QueueState queueState);  }