org.pz.platypus
Class CommandTable

java.lang.Object
  extended by org.pz.platypus.CommandTable

public class CommandTable
extends java.lang.Object

Table of all supported commands in Platypus. It's implemented using a key consisting of the command root (a String that is long enough to uniquely identify the command). All commands in the Platypus file are looked up in here; Command object that is returned contains all the info for parsing the command.

Author:
alb

Field Summary
protected  java.util.HashMap<java.lang.String,ICommand> commandTable
          the hashtable into which the commands are loaded
private  GDD gdd
           
 
Constructor Summary
CommandTable()
          This constructor is included here only because it facilitates writing mock Literals class for testing.
CommandTable(GDD Gdd)
           
 
Method Summary
 void add(ICommand entry)
          add a Commandable item to the hash table, using its root as the key to the entry
 ICommand getCommand(java.lang.String root)
          Lookup a command by its root
 void load()
          Load the commands and symbols into the command table.
 void loadCommand(java.lang.String root, java.lang.String attrib)
          adds an individual command from the property file into the Platypus parser command table
(package private)  PropertyFile loadCommandFile(java.lang.String commandFilename)
          Opens and reads the property file containing the commands
(package private)  void loadCommands(java.lang.String commandFilename)
          load commands in to the command table
(package private)  void loadCommandsFromFile(PropertyFile pf)
          Loads the commands from the property file into the command table
(package private)  void loadRemainingCommands()
          Family commands are not generally load-able from the property file; so they have to be loaded manually, as done here.
(package private)  void loadSymbols()
          load symbols and special characters.
(package private)  PropertyFile readCommandFile(java.lang.String filename)
          Read a property file listing commands to load into the Platy parser command table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandTable

protected java.util.HashMap<java.lang.String,ICommand> commandTable
the hashtable into which the commands are loaded


gdd

private GDD gdd
Constructor Detail

CommandTable

public CommandTable()
This constructor is included here only because it facilitates writing mock Literals class for testing. It's not called from Platypus working code.


CommandTable

public CommandTable(GDD Gdd)
Method Detail

load

public void load()
Load the commands and symbols into the command table. Commands are loaded in alpha order


loadCommands

void loadCommands(java.lang.String commandFilename)
load commands in to the command table

Parameters:
commandFilename - the file from which to read the commands

loadRemainingCommands

void loadRemainingCommands()
Family commands are not generally load-able from the property file; so they have to be loaded manually, as done here.


loadCommandFile

PropertyFile loadCommandFile(java.lang.String commandFilename)
Opens and reads the property file containing the commands

Parameters:
commandFilename - the name of the file to open and read
Returns:
the PropertyFile that was open and read

readCommandFile

PropertyFile readCommandFile(java.lang.String filename)
Read a property file listing commands to load into the Platy parser command table

Parameters:
filename - file with the commands
Returns:
the property file

loadCommandsFromFile

void loadCommandsFromFile(PropertyFile pf)
Loads the commands from the property file into the command table

Parameters:
pf - the property file to load from

loadCommand

public void loadCommand(java.lang.String root,
                        java.lang.String attrib)
adds an individual command from the property file into the Platypus parser command table

Parameters:
root - the key for the command
attrib - the command attributes, that specify the command type and other attributes

loadSymbols

void loadSymbols()
load symbols and special characters. These are loaded from a text file.


add

public void add(ICommand entry)
add a Commandable item to the hash table, using its root as the key to the entry

Parameters:
entry - to be added (either a command or a symbol)

getCommand

public ICommand getCommand(java.lang.String root)
Lookup a command by its root

Parameters:
root - command root (portion ending in the first | : or ] character
Returns:
the Commandable class found, or null on error


Copyright © 2008-10 Pacific Data Works LLC