Source:
public List<String> processInput(int stepNumber, ProgressStep step) { List<String> errors = new ArrayList<>(); if (stepNumber == 0) { step.accept(stockStep); qcStep.cancelInput(); stockBoxStep.cancelInput(); cancelStockBoxPositionStep(); aliquotStep.cancelInput(); aliquotBoxStep.cancelInput(); cancelAliquotHandlingSteps(); } else if (stepNumber == 1) { step.accept(qcStep); stockBoxStep.cancelInput(); cancelStockBoxPositionStep(); aliquotStep.cancelInput(); aliquotBoxStep.cancelInput(); cancelAliquotHandlingSteps(); } else if (stepNumber == 2) { step.accept(stockBoxStep); if (hasInput(stockBoxStep)) { stockBoxPositionStep = new StockBoxPositionStep(stockBoxStep.getBox()); aliquotStep.cancelInput(); aliquotBoxStep.cancelInput(); cancelAliquotHandlingSteps(); } else { errors.add(stockBoxStep.getError()); } } else if (stepNumber == 3) { step.accept(stockBoxPositionStep); if (hasInput(stockBoxPositionStep)) { aliquotStep.cancelInput(); aliquotBoxStep.cancelInput(); cancelAliquotHandlingSteps(); } else { errors.add(stockBoxPositionStep.getError()); } } else if (stepNumber == 4) { step.accept(aliquotStep); aliquotBoxStep.cancelInput(); aliquotBoxStep.setNumAliquots(aliquotStep.getAliquotQuantity()); cancelAliquotHandlingSteps(); } else if (stepNumber == 5) { step.accept(aliquotBoxStep); if (hasInput(aliquotBoxStep)) { resetAliquotHandlingSteps(aliquotStep.getAliquotQuantity(), aliquotBoxStep.getBox()); } else { errors.add(aliquotBoxStep.getError()); } } else { step.accept(aliquotHandlingSteps.get(asAliquotIndex(stepNumber))); if (aliquotHandlingSteps.get(asAliquotIndex(stepNumber)).getError() != null) { errors.add(aliquotHandlingSteps.get(asAliquotIndex(stepNumber)).getError()); } } return errors; }

Target:
public List<String> processInput(int stepNumber, ProgressStep step) { List<String> errors = new ArrayList<>(); switch (stepNumber) { case 0: step.accept(stockStep); qcStep.cancelInput(); stockBoxStep.cancelInput(); cancelStockBoxPositionStep(); aliquotStep.cancelInput(); aliquotBoxStep.cancelInput(); cancelAliquotHandlingSteps(); break; case 1: step.accept(qcStep); stockBoxStep.cancelInput(); cancelStockBoxPositionStep(); aliquotStep.cancelInput(); aliquotBoxStep.cancelInput(); cancelAliquotHandlingSteps(); break; case 2: step.accept(stockBoxStep); if (hasInput(stockBoxStep)) { stockBoxPositionStep = new StockBoxPositionStep(stockBoxStep.getBox()); aliquotStep.cancelInput(); aliquotBoxStep.cancelInput(); cancelAliquotHandlingSteps(); } else { errors.add(stockBoxStep.getError()); } break; case 3: step.accept(stockBoxPositionStep); if (hasInput(stockBoxPositionStep)) { aliquotStep.cancelInput(); aliquotBoxStep.cancelInput(); cancelAliquotHandlingSteps(); } else { errors.add(stockBoxPositionStep.getError()); } break; case 4: step.accept(aliquotStep); aliquotBoxStep.cancelInput(); aliquotBoxStep.setNumAliquots(aliquotStep.getAliquotQuantity()); cancelAliquotHandlingSteps(); break; case 5: step.accept(aliquotBoxStep); if (hasInput(aliquotBoxStep)) { resetAliquotHandlingSteps(aliquotStep.getAliquotQuantity(), aliquotBoxStep.getBox()); } else { errors.add(aliquotBoxStep.getError()); } break; default: step.accept(aliquotHandlingSteps.get(asAliquotIndex(stepNumber))); if (aliquotHandlingSteps.get(asAliquotIndex(stepNumber)).getError() != null) { errors.add(aliquotHandlingSteps.get(asAliquotIndex(stepNumber)).getError()); } break; } return errors; }