1:
2: package maze;
3:
4: public class MazeMoveCommand implements UndoableCommand {
5:
6: public MazeMoveCommand(Maze maze, Direction direction) {
7: this.maze = maze;
8: this.direction = direction;
9: }
10:
11: public void execute() {
12: maze.move(direction);
13: }
14:
15: public void undo() {
16: maze.move(direction.opposite());
17: }
18:
19: protected Maze maze;
20: protected Direction direction;
21:
22: }