|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectstudent.adventure.CommandWords
public class CommandWords
This class holds a collection of all command words known to the game. It is used to recognize commands as they are typed in.
Constructor Summary | |
---|---|
CommandWords()
Constructor - initialise the command words. |
Method Summary | |
---|---|
void |
addCommand(java.lang.String word,
Command command)
Add (or replace) a command word. |
Command |
get(java.lang.String word)
Given a command word, find and return the matching command object. |
void |
showAll()
Print all valid commands to System.out. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CommandWords()
Method Detail |
---|
public Command get(java.lang.String word)
word
- The word to look up
public void addCommand(java.lang.String word, Command command)
word
- the word for this commandcommand
- the associated command object implementing
this commandpublic void showAll()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |