The Command design pattern provides a way to encapsulate behavior in a class with well-known execution semantics. Listing 4 shows the result of applying these two patterns to the code in Listing 3.
公共设计模式提供了利用常规执行语句来在类中封装行为的方法。
The command pattern is distinguished by the encapsulation of distinct activities into reusable objects whose behavior can be parameterized per request.
Command 模式是非常有名的,它把一些独特的活动封装起来成为可重用的对象,对于每次请求,这些对象的行为都可以被参数化。
A command indicates a type of pattern to match, and a modifier can change the behavior that occurs in case of such a match.
命令显示欲匹配的此类模式,修饰符可以改变此类匹配中发生的行为。
应用推荐