Package com.example.renderer.command
Interface Command
- All Known Implementing Classes:
AddShapeCommand
public interface Command
Command接口定义了命令模式中的命令操作。
所有具体命令必须实现execute()执行操作和undo()撤销操作。 与UndoManager配合使用可实现操作的撤销/重做功能。
典型用法:
Command cmd = new AddShapeCommand(shapes, new Circle(10,10,5)); cmd.execute(); // 执行命令 cmd.undo(); // 撤销命令
-
Method Summary
-
Method Details
-
execute
void execute()Executes the command operation. Implementations should perform the actual operation here. -
undo
void undo()Undoes the command operation. Implementations should revert the execute() operation here.
-