Building Parsers with Java

sjm.examples.robot
Class RobotCommand

java.lang.Object
  |
  +--sjm.examples.robot.RobotCommand
Direct Known Subclasses:
PickCommand, PlaceCommand, ScanCommand

public class RobotCommand
extends java.lang.Object
implements PubliclyCloneable

A RobotCommand encapsulates the work that lies behind a high level command like "pick carrier from input1". In this package, the commands are just example targets of a parser; their execute() methods are not implemented.


Field Summary
protected  java.lang.String location
           
 
Constructor Summary
RobotCommand()
           
 
Method Summary
 java.lang.Object clone()
          Return a copy of this object.
 void execute()
          If we were really driving a factory, this is where we would turn high level commands into the protocols that various machines would understand.
 java.lang.String getLocation()
          Return the location that this command is for.
 void setLocation(java.lang.String location)
          Set the location for this command.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

location

protected java.lang.String location
Constructor Detail

RobotCommand

public RobotCommand()
Method Detail

clone

public java.lang.Object clone()
Return a copy of this object. If the location attribute becomes something more complicated than a String, then this method will become insufficient if location is not immutable.
Specified by:
clone in interface PubliclyCloneable
Overrides:
clone in class java.lang.Object
Returns:
a copy of this object

execute

public void execute()
If we were really driving a factory, this is where we would turn high level commands into the protocols that various machines would understand. For example, a pick command might send messages to both a conveyor and to a track robot.

getLocation

public java.lang.String getLocation()
Return the location that this command is for.
Returns:
the location that this command is for

setLocation

public void setLocation(java.lang.String location)
Set the location for this command.
Parameters:
String - the location

by Steve Metsker