platypus
Class CommandId

java.lang.Object
  extended by platypus.CommandId

public class CommandId
extends java.lang.Object

All supported commands are placed in a tree, where each node consists of the command string and a command identifier, which will be used to call the right routine. Used by the Command class.

Author:
alb

Field Summary
(package private)  java.util.TreeMap<java.lang.String,java.lang.Integer> commands
          a tree consisting of the command lexemes and the associated token types
 
Constructor Summary
CommandId()
           
 
Method Summary
 int FTOgetCommandCount()
          Returns the number of commands in the command tree.
 java.util.TreeMap<java.lang.String,java.lang.Integer> FTOgetCommands()
          For testing only (FTO).
 int get(java.lang.String key)
          Returns the type of the command based on looking up the command lexeme
private  void loadCommands()
          Loads all the supported commands into the CommandID tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commands

final java.util.TreeMap<java.lang.String,java.lang.Integer> commands
a tree consisting of the command lexemes and the associated token types

Constructor Detail

CommandId

public CommandId()
Method Detail

loadCommands

private void loadCommands()
Loads all the supported commands into the CommandID tree.


get

public int get(java.lang.String key)
Returns the type of the command based on looking up the command lexeme

Parameters:
key - command lexeme to look up
Returns:
the type if found; INVALID_PARAM if not found; INVALID_PARAM_NULL if key is null

FTOgetCommandCount

public int FTOgetCommandCount()
Returns the number of commands in the command tree. This function is used for testing only (FTO).

Returns:
the number of entries in the tree containing all recognized commands.

FTOgetCommands

public java.util.TreeMap<java.lang.String,java.lang.Integer> FTOgetCommands()
For testing only (FTO). Returns the commands that have been entered

Returns:
commands in a TreeMap


Copyright © 2006-7 Pacific Data Works LLC