The class diagram of the command pattern is as follows:
We can distinguish the following actors in the preceding implementation diagram:
- Command: This is the abstraction that represents the encapsulation of a command. It declares the abstract method executed, which should be implemented by all the concrete commands.
- ConcreteCommand: This is the actual implementation of the Command. It has to execute the command and deal with the parameters associated with each concrete command. It delegates the command to the receiver.
- Receiver: This is the class responsible for executing the action associated with the command.
- Invoker: This ...