类 CommandManager

java.lang.Object
com.example.graphics.command.CommandManager

public class CommandManager extends Object
Manager for executing, undoing, and redoing commands. This is part of the Command pattern implementation.
  • 字段详细资料

  • 构造器详细资料

    • CommandManager

      public CommandManager()
      Constructor initializes the command stacks
  • 方法详细资料

    • executeCommand

      public void executeCommand(Command command)
      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