cs1705.adventure
Class CommandWords

java.lang.Object
  extended bycs1705.adventure.CommandWords

public class CommandWords
extends Object

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

Version:
2.0 (December 2002)
Author:
Michael Kolling and David J. Barnes

Constructor Summary
CommandWords()
          Constructor - initialise the command words.
 
Method Summary
 void addCommand(String word, Command command)
          Add (or replace) a command word.
 Command get(String word)
          Given a command word, find and return the matching command object.
 void showAll()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandWords

public CommandWords()
Constructor - initialise the command words.

Method Detail

addCommand

public void addCommand(String word,
                       Command command)
Add (or replace) a command word.

Parameters:
word - the word for this command
command - the associated command object implementing this command

get

public Command get(String word)
Given a command word, find and return the matching command object. Return null if there is no command with this name.


showAll

public void showAll()