jimmc.roots
Class CommandInterpreter

java.lang.Object
  |
  +--jimmc.roots.CommandInterpreter
All Implemented Interfaces:
java.lang.Runnable

public class CommandInterpreter
extends java.lang.Object
implements java.lang.Runnable

CommandInterpreter is a simple command interpreter for a RootsBase.


Field Summary
 java.util.Hashtable commandDictionary
           
 java.util.Hashtable printFormatDictionary
           
 java.util.Hashtable recordFormatDictionary
           
 boolean runMe
           
 
Constructor Summary
CommandInterpreter()
          Create a CommandInterpreter with no attached RootsBase
CommandInterpreter(RootsBase b)
          Create a CommandInterpreter with an attached RootsBase
 
Method Summary
 void addCommand(Command c)
          Add one command to our dictionary
 void addPrintFormat(PrintFormat f)
          Add one print format to our dictionary
 void addRecordFormat(RecordFormat f)
          Add one record format to our dictionary
 void doCommand(java.lang.String line)
          Parse and execute a single command line
 void doCommand(java.lang.String[] words)
          Execute a single command from an array of word strings
 Command findCommand(java.lang.String name)
          Get a command by name.
 PrintFormat findPrintFormat(java.lang.String name)
          Get a print format by name.
 RecordFormat findRecordFormat(java.lang.String name)
          Get a record format by name.
 java.lang.String[] getPrintFormats()
          Get a list of the print formats.
 java.lang.String[] getRecordFormats()
          Get a list of the record formats.
 java.lang.String[] parseCommandLine(java.lang.String line)
          Parse a single command line into an array of strings.
 void run()
          Run the CommandInterpreter thread when caller invokes 'start'
 void setInputStream(java.io.InputStream rawIn)
           
 void setRootsBase(RootsBase b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runMe

public boolean runMe

commandDictionary

public java.util.Hashtable commandDictionary

printFormatDictionary

public java.util.Hashtable printFormatDictionary

recordFormatDictionary

public java.util.Hashtable recordFormatDictionary
Constructor Detail

CommandInterpreter

public CommandInterpreter()
Create a CommandInterpreter with no attached RootsBase

CommandInterpreter

public CommandInterpreter(RootsBase b)
Create a CommandInterpreter with an attached RootsBase
Method Detail

addCommand

public void addCommand(Command c)
Add one command to our dictionary

findCommand

public Command findCommand(java.lang.String name)
Get a command by name.

addPrintFormat

public void addPrintFormat(PrintFormat f)
Add one print format to our dictionary

findPrintFormat

public PrintFormat findPrintFormat(java.lang.String name)
Get a print format by name.

getPrintFormats

public java.lang.String[] getPrintFormats()
Get a list of the print formats.

addRecordFormat

public void addRecordFormat(RecordFormat f)
Add one record format to our dictionary

findRecordFormat

public RecordFormat findRecordFormat(java.lang.String name)
Get a record format by name.

getRecordFormats

public java.lang.String[] getRecordFormats()
Get a list of the record formats.

setInputStream

public void setInputStream(java.io.InputStream rawIn)

setRootsBase

public void setRootsBase(RootsBase b)

run

public void run()
Run the CommandInterpreter thread when caller invokes 'start'
Specified by:
run in interface java.lang.Runnable

doCommand

public void doCommand(java.lang.String line)
Parse and execute a single command line

parseCommandLine

public java.lang.String[] parseCommandLine(java.lang.String line)
Parse a single command line into an array of strings.

doCommand

public void doCommand(java.lang.String[] words)
Execute a single command from an array of word strings