implementing part of Parser class

This commit is contained in:
Leonardo Brandenberger
2021-12-01 23:24:16 +01:00
parent 3830cf6594
commit 9e347e8792
5 changed files with 103 additions and 6 deletions
+14 -3
View File
@@ -1,11 +1,22 @@
package ch.zhaw.catan;
import org.beryx.textio.TextIO;
public enum Command {
NEXTPLAYER ("next Player"), QUIT("quit");
NEXTPLAYER ("next Player"), QUIT("quit"), UNKNOWN ("unknown");
private String commandWord;
public static <T extends Enum<T>> T getEnumValue(TextIO textIO, Class<T> commands) {
return textIO.newEnumInputReader(commands).read("What would you like to do?");
}
private String CommandWord;
Command(String commandWord) {
this.CommandWord = commandWord;
this.commandWord = commandWord;
}
public String toString() {
return commandWord;
}
}