package class7_3_RemoteControl_inClass.other; import class7_3_RemoteControl_inClass.Car; /** * Concrete command object used to make the car shut off * @author hornick * */ public class CarStopCommand implements Command { private Car cc; // the auto to which this command applies private String name; // the command phrase /** * Constructor - associates this command with a specific automobile * @param cc CarController that this command affects * @param label - the command name to use in UI components */ public CarStopCommand(Car cc, String label ) { this.cc = cc; this.name = label; } @Override public String getCommandName() { return name; } @Override /** * Stop the engine */ public boolean execute() { cc.stopEngine(); return true; } @Override /** * Can't unexecute engine stop */ public boolean unexecute() { return false; } }