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

Public Member Functions

 MoveShapeCommand (Shape shape, int newX, int newY)
void execute ()
void undo ()

Private Attributes

final int newX
final int newY
final int oldX
final int oldY
final Shape shape

Detailed Description

Command for moving a shape to a new position. This is an implementation of the Command pattern.

Definition at line 9 of file MoveShapeCommand.java.

Constructor & Destructor Documentation

◆ MoveShapeCommand()

com.example.graphics.command.MoveShapeCommand.MoveShapeCommand ( Shape shape,
int newX,
int newY )
inline

Constructor for the MoveShapeCommand

Parameters
shapethe shape to move
newXthe new x coordinate
newYthe new y coordinate

Definition at line 22 of file MoveShapeCommand.java.

References newX, newY, and shape.

Member Function Documentation

◆ execute()

void com.example.graphics.command.MoveShapeCommand.execute ( )
inline

Execute the command

Implements com.example.graphics.command.Command.

Definition at line 31 of file MoveShapeCommand.java.

References newX, newY, and shape.

◆ undo()

void com.example.graphics.command.MoveShapeCommand.undo ( )
inline

Undo the command

Implements com.example.graphics.command.Command.

Definition at line 36 of file MoveShapeCommand.java.

References oldX, oldY, and shape.

Member Data Documentation

◆ newX

final int com.example.graphics.command.MoveShapeCommand.newX
private

Definition at line 11 of file MoveShapeCommand.java.

Referenced by MoveShapeCommand(), and execute().

◆ newY

final int com.example.graphics.command.MoveShapeCommand.newY
private

Definition at line 12 of file MoveShapeCommand.java.

Referenced by MoveShapeCommand(), and execute().

◆ oldX

final int com.example.graphics.command.MoveShapeCommand.oldX
private

Definition at line 13 of file MoveShapeCommand.java.

Referenced by undo().

◆ oldY

final int com.example.graphics.command.MoveShapeCommand.oldY
private

Definition at line 14 of file MoveShapeCommand.java.

Referenced by undo().

◆ shape

final Shape com.example.graphics.command.MoveShapeCommand.shape
private

Definition at line 10 of file MoveShapeCommand.java.

Referenced by MoveShapeCommand(), execute(), and undo().


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