Package com.example.renderer.command
Class AddShapeCommand
java.lang.Object
com.example.renderer.command.AddShapeCommand
- All Implemented Interfaces:
Command
Command implementation for adding a shape to a shape list.
Supports undo operation by removing the added shape.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
AddShapeCommand
创建添加图形命令实例- Parameters:
shapes
- 目标图形列表(非null)shape
- 要添加的图形(非null)- Throws:
NullPointerException
- 如果参数为null
-
-
Method Details
-
execute
public void execute()Description copied from interface:Command
Executes the command operation. Implementations should perform the actual operation here. -
undo
public void undo()Description copied from interface:Command
Undoes the command operation. Implementations should revert the execute() operation here.
-