package class7_3_RemoteControl.other; import class7_3_RemoteControl.Robot; /** * Concrete command object used to make the robot clean * @author hornick * */ public class RobotTidyCommand 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 RobotTidyCommand(Robot rc, String label ) { this.rc = rc; this.name = label; } @Override public String getCommandName() { return name; } @Override /** * Execute the tidy command */ public boolean execute() { rc.tidy(); return true; } @Override /** * Execute the mess command */ public boolean unexecute() { rc.mess(); return true; } }