gshute.ioutil
Class Command

java.lang.Object
  |
  +--gshute.ioutil.Command

public class Command
extends java.lang.Object

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

name

protected java.lang.String name
name is the name of this command as it appears in a file.

arguments

protected java.lang.String arguments
arguments is the list of arguments for this command.

brief

protected java.lang.String brief
brief is a brief description of this command.

full

protected java.lang.String full
name is a full description of this command.
Constructor Detail

Command

public 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 Detail

commandName

public java.lang.String commandName()
comm.commandName() returns the command name string for comm.

nameLength

public int nameLength()
comm.nameLength() returns the length of the command name string for comm.

synopsis

public java.lang.String synopsis()
comm.synopsis() returns the synopsis string for comm.

synopsisLength

public int synopsisLength()
comm.synopsisLength() returns the length of the synopsis string for comm.

briefHelp

public java.lang.String briefHelp()
comm.briefHelp() returns the brief help string for comm.

fullHelp

public java.lang.String fullHelp()
comm.fullHelp() returns the full help string for comm.

briefDescription

public java.lang.String briefDescription(int nameWidth)
comm.briefDescription(nameWidth) returns the brief description string for comm. This string consists of the name of comm, right justified in a field of width nameWidth, followed by a dash and the brief help string for comm.

fullDescription

public java.lang.String fullDescription()
comm.fullDescription() returns the full description string for comm. This string consists of the name and argument list of comm, followed by the full help string for comm on a separate line.

execute

public void execute(LineScanner args)
comm.execute(args) executes the command comm with arguments read from args.