Class CommandWords

java.lang.Object
  extended by CommandWords

public class CommandWords
extends Object

This class is part of the "World of Zuul" application. "World of Zuul" is a very simple, text based adventure game. This class holds an enumeration of all command words known to the game. It is used to recognise commands as they are typed in.

Version:
2006.03.30
Author:
Michael Kolling and David J. Barnes

Constructor Summary
CommandWords()
          Constructor - initialise the command words.
 
Method Summary
 CommandWord getCommandWord(String commandWord)
          Find the CommandWord associated with a command word.
 boolean isCommand(String aString)
          Check whether a given String is a valid command word.
 void showAll()
          Print all valid commands to System.out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandWords

public CommandWords()
Constructor - initialise the command words.

Method Detail

getCommandWord

public CommandWord getCommandWord(String commandWord)
Find the CommandWord associated with a command word.

Parameters:
commandWord - The word to look up.
Returns:
The CommandWord correspondng to commandWord, or UNKNOWN if it is not a valid command word.

isCommand

public boolean isCommand(String aString)
Check whether a given String is a valid command word.

Returns:
true if it is, false if it isn't.

showAll

public void showAll()
Print all valid commands to System.out.