package class7_3_RemoteControl_inClass.other; import class7_3_RemoteControl_inClass.Robot; /** * Concrete command object used to make the robot scrub * @author hornick * */ public class RobotScrubCommand implements Command { private Robot rc; // the robot to which this command applies private String name; // the command name /** * Constructor - associates this command with a specific robot * @param rc - robot that this command controls * @param label - the command name to use in UI components */ public RobotScrubCommand(Robot rc, String label ) { this.rc = rc; this.name = label; } @Override public String getCommandName() { return name; } @Override /** * Execute the scrub command */ public boolean execute() { rc.scrub(); return true; } @Override /** * Can't unexecute scrub */ public boolean unexecute() { return false; } }