类 CommandManager
java.lang.Object
com.example.graphics.command.CommandManager
Manager for executing, undoing, and redoing commands.
This is part of the Command pattern implementation.
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明boolean
canRedo()
Check if there are commands that can be redoneboolean
canUndo()
Check if there are commands that can be undonevoid
Clear all command historyvoid
executeCommand
(Command command) Execute a command and add it to the undo stackboolean
redo()
Redo the most recently undone commandboolean
undo()
Undo the most recently executed command
-
字段详细资料
-
undoStack
-
redoStack
-
-
构造器详细资料
-
CommandManager
public CommandManager()Constructor initializes the command stacks
-
-
方法详细资料
-
executeCommand
Execute a command and add it to the undo stack- 参数:
command
- the command to execute
-
undo
public boolean undo()Undo the most recently executed command- 返回:
- true if a command was undone, false if there are no commands to undo
-
redo
public boolean redo()Redo the most recently undone command- 返回:
- true if a command was redone, false if there are no commands to redo
-
canUndo
public boolean canUndo()Check if there are commands that can be undone- 返回:
- true if there are commands that can be undone, false otherwise
-
canRedo
public boolean canRedo()Check if there are commands that can be redone- 返回:
- true if there are commands that can be redone, false otherwise
-
clearHistory
public void clearHistory()Clear all command history
-