|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ioutil.CommandTable
A CommandTable provides a means for storing, retrieving, and executing commands for command-driven interpreter programs.
Constructor Summary | |
CommandTable()
new CommandTable() returns a new empty CommandTable. |
Method Summary | |
void |
add(Command comm)
ct.add(comm) adds comm to ct. |
void |
displayHelp(java.lang.String str)
ct.displayHelp(String str) displays full descriptions for Commands in ct whose name matches str. |
void |
displayMenu()
ct.displayMenu() displays a menu of commands in ct. |
static Command |
doNothingCommand(java.lang.String str)
CommandTable.doNothingCommand(str) returns a Command that does nothing. |
void |
execute(LineScanner commLine)
ct.execute(commLine) executes the Command whose name is the first word of commLine and whose arguments are the remaining words of commLine. |
Command |
helpCommand(java.lang.String str)
ct.helpCommand(str) returns a Command named str. |
static Command |
quitCommand(java.lang.String str)
CommandTable.quitCommand(str) returns a Command that terminates the program. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public CommandTable()
Method Detail |
public void add(Command comm)
Preconditions:
The name of comm is not an empty string.
The name of comm is not a prefix of the name of any Command in
ct.
No name of a Command in ct is a prefix of the name of comm.
public void execute(LineScanner commLine)
public void displayMenu()
public void displayHelp(java.lang.String str)
public Command helpCommand(java.lang.String str)
public static Command doNothingCommand(java.lang.String str)
public static Command quitCommand(java.lang.String str)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |