|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gshute.ioutil.Command
The Command class is the parent class for subclasses whose instances are commands that can be stored in a CommandTable for execution in a command interpreter program. A subclass can provide a name, argument list string, and brief and full help strings for its instances with initialization code in the subclass definition. The Command class implements methods for use in displaying menus that decribe commands. Commands in the parent Command class do nothing when executed. Subclasses can override the execute() method to implement useful commands, using its LineScanner argument to get command-line arguments.
Field Summary | |
protected java.lang.String |
arguments
arguments is the list of arguments for this command. |
protected java.lang.String |
brief
brief is a brief description of this command. |
protected java.lang.String |
full
name is a full description of this command. |
protected java.lang.String |
name
name is the name of this command as it appears in a file. |
Constructor Summary | |
Command()
new Command() returns a command whose name is "#", whose argument string is an empty string, and whose brief and full descriptions are "line is a comment" |
Method Summary | |
java.lang.String |
briefDescription(int nameWidth)
comm.briefDescription(nameWidth) returns the brief description string for comm. |
java.lang.String |
briefHelp()
comm.briefHelp() returns the brief help string for comm. |
java.lang.String |
commandName()
comm.commandName() returns the command name string for comm. |
void |
execute(LineScanner args)
comm.execute(args) executes the command comm with arguments read from args. |
java.lang.String |
fullDescription()
comm.fullDescription() returns the full description string for comm. |
java.lang.String |
fullHelp()
comm.fullHelp() returns the full help string for comm. |
int |
nameLength()
comm.nameLength() returns the length of the command name string for comm. |
java.lang.String |
synopsis()
comm.synopsis() returns the synopsis string for comm. |
int |
synopsisLength()
comm.synopsisLength() returns the length of the synopsis string for comm. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.lang.String name
protected java.lang.String arguments
protected java.lang.String brief
protected java.lang.String full
Constructor Detail |
public Command()
Method Detail |
public java.lang.String commandName()
public int nameLength()
public java.lang.String synopsis()
public int synopsisLength()
public java.lang.String briefHelp()
public java.lang.String fullHelp()
public java.lang.String briefDescription(int nameWidth)
public java.lang.String fullDescription()
public void execute(LineScanner args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |