Class CommandParser
java.lang.Object
|
+--CommandParser
- Direct Known Subclasses:
- DefaultCommandParser
- public abstract class CommandParser
- extends java.lang.Object
An abstract class to encapsulate the functionality required to parse a
simulation file and extract commands to simulate the robot's actions.
- See Also:
CommandQueue
,
Command
Constructor Summary |
protected |
CommandParser()
Private constructor to prevent direct instantiation. |
Method Summary |
abstract CommandQueue |
getCommandQueue()
Returns a CommandQueue of Commands parsed from the simulation file. |
abstract java.util.Hashtable |
getNameTable()
Gets the Hashtable of valid names for the Robot's Degrees of freedom. |
static CommandParser |
loadParser(java.lang.String s)
Loads the CommandParser class specified by the given String. |
abstract void |
loadSimulation(java.io.Reader r)
Loads the simulation file using the specified Reader. |
abstract void |
setNameTable(java.util.Hashtable names)
Sets the Hashtable of names for the Robot's Degrees of freedom. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
CommandParser
protected CommandParser()
- Private constructor to prevent direct instantiation. Use the method
loadParser
to load a specific CommandParser instance.
getCommandQueue
public abstract CommandQueue getCommandQueue()
- Returns a CommandQueue of Commands parsed from the simulation file.
- Returns:
- the CommandQueue object of parsed Command objects.
setNameTable
public abstract void setNameTable(java.util.Hashtable names)
- Sets the Hashtable of names for the Robot's Degrees of freedom.
- Parameters:
names
- the Hashtable of names for the Robot's joints.
getNameTable
public abstract java.util.Hashtable getNameTable()
- Gets the Hashtable of valid names for the Robot's Degrees of freedom.
- Returns:
- the Hashtable of name for the Robot's joints.
loadSimulation
public abstract void loadSimulation(java.io.Reader r)
throws CommandParserException
- Loads the simulation file using the specified Reader.
- Parameters:
r
- the Reader to parse for Commands.- Throws:
- CommandParserException - indicates error parsing Reader.
loadParser
public static final CommandParser loadParser(java.lang.String s)
throws CommandParserException
- Loads the CommandParser class specified by the given String.
- Parameters:
s
- the name of the CommandParser class to be loaded.- Returns:
- an instance of the requested CommandParser class.
- Throws:
- CommandParserException - indicates an error loading the parser.