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.
1package com.example.graphics.command;
2
3import com.example.graphics.model.Shape;
4import java.util.List;
5
10public 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}
AddShapeCommand(List< Shape > shapes, Shape shape)