Graphic Rendering System 1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
com.example.graphics.command.CommandManager Class Reference
Collaboration diagram for com.example.graphics.command.CommandManager:
Collaboration graph

Public Member Functions

 CommandManager ()
boolean canRedo ()
boolean canUndo ()
void clearHistory ()
void executeCommand (Command command)
boolean redo ()
boolean undo ()

Private Attributes

final Stack< CommandredoStack
final Stack< CommandundoStack

Detailed Description

Manager for executing, undoing, and redoing commands. This is part of the Command pattern implementation.

Definition at line 9 of file CommandManager.java.

Constructor & Destructor Documentation

◆ CommandManager()

com.example.graphics.command.CommandManager.CommandManager ( )
inline

Constructor initializes the command stacks

Definition at line 16 of file CommandManager.java.

References redoStack, and undoStack.

Member Function Documentation

◆ canRedo()

boolean com.example.graphics.command.CommandManager.canRedo ( )
inline

Check if there are commands that can be redone

Returns
true if there are commands that can be redone, false otherwise

Definition at line 73 of file CommandManager.java.

References redoStack.

◆ canUndo()

boolean com.example.graphics.command.CommandManager.canUndo ( )
inline

Check if there are commands that can be undone

Returns
true if there are commands that can be undone, false otherwise

Definition at line 65 of file CommandManager.java.

References undoStack.

◆ clearHistory()

void com.example.graphics.command.CommandManager.clearHistory ( )
inline

Clear all command history

Definition at line 80 of file CommandManager.java.

References redoStack, and undoStack.

◆ executeCommand()

void com.example.graphics.command.CommandManager.executeCommand ( Command command)
inline

Execute a command and add it to the undo stack

Parameters
commandthe command to execute

Definition at line 25 of file CommandManager.java.

References redoStack, and undoStack.

◆ redo()

boolean com.example.graphics.command.CommandManager.redo ( )
inline

Redo the most recently undone command

Returns
true if a command was redone, false if there are no commands to redo

Definition at line 50 of file CommandManager.java.

References redoStack, and undoStack.

◆ undo()

boolean com.example.graphics.command.CommandManager.undo ( )
inline

Undo the most recently executed command

Returns
true if a command was undone, false if there are no commands to undo

Definition at line 35 of file CommandManager.java.

References redoStack, and undoStack.

Member Data Documentation

◆ redoStack

final Stack<Command> com.example.graphics.command.CommandManager.redoStack
private

Definition at line 11 of file CommandManager.java.

Referenced by CommandManager(), canRedo(), clearHistory(), executeCommand(), redo(), and undo().

◆ undoStack

final Stack<Command> com.example.graphics.command.CommandManager.undoStack
private

Definition at line 10 of file CommandManager.java.

Referenced by CommandManager(), canUndo(), clearHistory(), executeCommand(), redo(), and undo().


The documentation for this class was generated from the following file: