Created
March 23, 2015 21:03
-
-
Save pumpkincouture/37ede2875eaf53d2ee7a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ParticipantChoice implements Choice { | |
| private CommandLineInterface ui; | |
| private int playerOption; | |
| private ChoiceValidator choiceValidator; | |
| public ParticipantChoice(CommandLineInterface ui) { | |
| this.ui = ui; | |
| } | |
| public List<String> addValidChoices() { | |
| List<String> validChoices = new ArrayList<>(); | |
| validChoices.add("1"); | |
| validChoices.add("2"); | |
| validChoices.add("3"); | |
| validChoices.add("4"); | |
| return validChoices; | |
| } | |
| public void validatePlayerConfiguration(String gameConfigurationChoice) { | |
| choiceValidator = new ChoiceValidator(); | |
| if (choiceValidator.validUserChoice(gameConfigurationChoice, addValidChoices()) == 0) { | |
| getPlayerOption(gameConfigurationChoice); | |
| } else { | |
| playerOption = choiceValidator.validUserChoice(gameConfigurationChoice, addValidChoices()); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment