package cs6601.p1; public class Command { public enum TYPE { boardsize, clear_board, final_status_list, genmove, INVALID, komi, list_commands, name, play, quit, version }; private String[] cmdFields; private String text; private TYPE type; public Command(TYPE type, String text, String[] cmdFields) { this.type = type; this.text = text; this.cmdFields = cmdFields; } public double getDoubleField(int index) { return Double.valueOf(cmdFields[index]); } public int getIntField(int index) { return Integer.valueOf(cmdFields[index]); } public String getStringField(int index) { return cmdFields[index]; } public String getText() { return text; } public TYPE getType() { return type; } public String toString() { return "[" + type.toString() + "] " + text; } }