Graphic Rendering System
1.0
A Java-based graphic rendering system implementing various design patterns
Loading...
Searching...
No Matches
AddShapeCommand.java
Go to the documentation of this file.
1
package
com.example.graphics.command;
2
3
import
com.example.graphics.model.Shape;
4
import
java.util.List;
5
10
public
class
AddShapeCommand
implements
Command
{
11
private
final
List<Shape>
shapes
;
12
private
final
Shape
shape
;
13
19
public
AddShapeCommand
(List<Shape>
shapes
,
Shape
shape
) {
20
this.shapes =
shapes
;
21
this.shape =
shape
;
22
}
23
24
@Override
25
public
void
execute
() {
26
shapes
.add(
shape
);
27
}
28
29
@Override
30
public
void
undo
() {
31
shapes
.remove(
shape
);
32
}
33
}
com.example.graphics.command.AddShapeCommand.shapes
final List< Shape > shapes
Definition
AddShapeCommand.java:11
com.example.graphics.command.AddShapeCommand.undo
void undo()
Definition
AddShapeCommand.java:30
com.example.graphics.command.AddShapeCommand.shape
final Shape shape
Definition
AddShapeCommand.java:12
com.example.graphics.command.AddShapeCommand.AddShapeCommand
AddShapeCommand(List< Shape > shapes, Shape shape)
Definition
AddShapeCommand.java:19
com.example.graphics.command.AddShapeCommand.execute
void execute()
Definition
AddShapeCommand.java:25
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
AddShapeCommand.java
Generated on
for Graphic Rendering System by
1.14.0