jimmc.roots
Class Command

java.lang.Object
  |
  +--jimmc.roots.Command
All Implemented Interfaces:
PrintHelp

public abstract class Command
extends java.lang.Object
implements PrintHelp

Command is a superclass for commands used by CommandInterpreter.


Constructor Summary
Command(CommandInterpreter ci)
          Create a Command object.
 
Method Summary
abstract  boolean action(java.lang.String[] words)
          The action performed by this command.
static void AddDefaultCommands(CommandInterpreter ci)
          Add the default commands
abstract  java.lang.String getName()
          The name of this command.
protected  void missingArgument(java.lang.String what)
          Report an error when not enough arguments.
protected  void println(java.lang.String s)
           
abstract  void printOneLineHelp()
          Print one line of help about the command.
protected  void tooManyArguments()
          Report an error when too many arguments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command(CommandInterpreter ci)
Create a Command object.
Method Detail

getName

public abstract java.lang.String getName()
The name of this command. Subclass must implement this method.
Returns:
the name of this command

action

public abstract boolean action(java.lang.String[] words)
The action performed by this command.
Returns:
true if OK

printOneLineHelp

public abstract void printOneLineHelp()
Print one line of help about the command.
Specified by:
printOneLineHelp in interface PrintHelp

missingArgument

protected void missingArgument(java.lang.String what)
Report an error when not enough arguments.

tooManyArguments

protected void tooManyArguments()
Report an error when too many arguments

println

protected void println(java.lang.String s)

AddDefaultCommands

public static void AddDefaultCommands(CommandInterpreter ci)
Add the default commands