-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCommandWord.java
More file actions
33 lines (30 loc) · 838 Bytes
/
CommandWord.java
File metadata and controls
33 lines (30 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* Representations for all the valid command words for the game
* along with a string in a particular language.
*
* @author Michael Kölling and David J. Barnes
* @version 2011.08.10
*/
public enum CommandWord
{
// A value for each command word along with its
// corresponding user interface string.
GO("go"), QUIT("quit"), HELP("help"), MARK("mark"), BACK("back"), UNKNOWN("?"), TIME("time");
// The command string.
private String commandString;
/**
* Initialise with the corresponding command string.
* @param commandString The command string.
*/
CommandWord(String commandString)
{
this.commandString = commandString;
}
/**
* @return The command word as a string.
*/
public String toString()
{
return commandString;
}
}