Graphic Rendering System
1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
MoveShapeCommand.java
Go to the documentation of this file.
1
package
com.example.graphics.command;
2
3
import
com.example.graphics.model.Shape;
4
9
public
class
MoveShapeCommand
implements
Command
{
10
private
final
Shape
shape
;
11
private
final
int
newX
;
12
private
final
int
newY
;
13
private
final
int
oldX
;
14
private
final
int
oldY
;
15
22
public
MoveShapeCommand
(
Shape
shape
,
int
newX
,
int
newY
) {
23
this.shape =
shape
;
24
this.newX =
newX
;
25
this.newY =
newY
;
26
this.oldX =
shape
.getX();
27
this.oldY =
shape
.getY();
28
}
29
30
@Override
31
public
void
execute
() {
32
shape
.setPosition(
newX
,
newY
);
33
}
34
35
@Override
36
public
void
undo
() {
37
shape
.setPosition(
oldX
,
oldY
);
38
}
39
}
com.example.graphics.command.MoveShapeCommand.newX
final int newX
Definition
MoveShapeCommand.java:11
com.example.graphics.command.MoveShapeCommand.oldX
final int oldX
Definition
MoveShapeCommand.java:13
com.example.graphics.command.MoveShapeCommand.execute
void execute()
Definition
MoveShapeCommand.java:31
com.example.graphics.command.MoveShapeCommand.newY
final int newY
Definition
MoveShapeCommand.java:12
com.example.graphics.command.MoveShapeCommand.shape
final Shape shape
Definition
MoveShapeCommand.java:10
com.example.graphics.command.MoveShapeCommand.MoveShapeCommand
MoveShapeCommand(Shape shape, int newX, int newY)
Definition
MoveShapeCommand.java:22
com.example.graphics.command.MoveShapeCommand.oldY
final int oldY
Definition
MoveShapeCommand.java:14
com.example.graphics.command.MoveShapeCommand.undo
void undo()
Definition
MoveShapeCommand.java:36
com.example.graphics.command.Command
Definition
Command.java:7
com.example.graphics.model.Shape
Definition
Shape.java:10
src
main
java
com
example
graphics
command
MoveShapeCommand.java
Generated on
for Graphic Rendering System by
1.14.0