DesignThe design of the Command pattern is shown in Figure 8-6. TheCli dịch - DesignThe design of the Command pattern is shown in Figure 8-6. TheCli Việt làm thế nào để nói

DesignThe design of the Command pat

Design
The design of the Command pattern is shown in Figure 8-6. TheClienthas a certain way of saying what is required, usually in high-level and domain-specific terms. It thinks in terms of commands such as Cut, Redo, Open, and so on. TheReceivers— and there may be several—know how to carry out these requests. Referring to the menu example, a Cut command for text would go to one part of a system and a Cut command for an image would be handled elsewhere.

TheCommand class forms the interface between the Clientand theReceivers. In a
Command object, theClient’s requests are declared and associated with viable corresponding operations in aReceiver. There might also be a state that the Clientwants to pass on to theReceiver, and this must be allowed for. The Invokeris there to distance theClientfrom theReceiver.
Put simply, theClientissues a call to Executein the Invoker, and the request goes to the Commandand then toActionin the Receiver. In a program, there could be many requests of different types being routed to different Receivers. TheICommandinterface ensures that they all conform to a standard form. The players in this pattern are:
Client
Creates and executesCommands
ICommand
An interface that specifies theExecuteoperation
Invoker
Asks theCommandto carry out theAction
Command
A class that implements theExecuteoperation by invoking operations on the
Receiver
Receiver
Any class that can perform the requiredAction
Action
The operation that needs to be performed
The Command pattern does seem to have many players, but some of them fall away when delegates are used, as shown in the next section. Other aspects of the design are:
• Commands can be assembled into composite commands in theCommandclass.
• New commands can be added without disturbing existing ones.
0/5000
Từ: -
Sang: -
Kết quả (Việt) 1: [Sao chép]
Sao chép!
DesignThe design of the Command pattern is shown in Figure 8-6. TheClienthas a certain way of saying what is required, usually in high-level and domain-specific terms. It thinks in terms of commands such as Cut, Redo, Open, and so on. TheReceivers— and there may be several—know how to carry out these requests. Referring to the menu example, a Cut command for text would go to one part of a system and a Cut command for an image would be handled elsewhere.TheCommand class forms the interface between the Clientand theReceivers. In aCommand object, theClient’s requests are declared and associated with viable corresponding operations in aReceiver. There might also be a state that the Clientwants to pass on to theReceiver, and this must be allowed for. The Invokeris there to distance theClientfrom theReceiver.Put simply, theClientissues a call to Executein the Invoker, and the request goes to the Commandand then toActionin the Receiver. In a program, there could be many requests of different types being routed to different Receivers. TheICommandinterface ensures that they all conform to a standard form. The players in this pattern are:ClientCreates and executesCommandsICommandAn interface that specifies theExecuteoperationInvokerAsks theCommandto carry out theActionCommandA class that implements theExecuteoperation by invoking operations on theReceiverReceiverAny class that can perform the requiredActionActionThe operation that needs to be performedThe Command pattern does seem to have many players, but some of them fall away when delegates are used, as shown in the next section. Other aspects of the design are:• Commands can be assembled into composite commands in theCommandclass.• New commands can be added without disturbing existing ones.
đang được dịch, vui lòng đợi..
Kết quả (Việt) 2:[Sao chép]
Sao chép!
Thiết kế
Thiết kế của mẫu Command được thể hiện trong hình 8-6. TheClienthas một cách nào đó để nói những gì là cần thiết, thường là ở cấp cao và các điều khoản tên miền cụ thể. Nó nghĩ rằng trong điều kiện của lệnh như Cut, Redo, Open, và như vậy. TheReceivers- và có thể có nhiều, biết làm thế nào để thực hiện những yêu cầu này. Đề cập đến các ví dụ thực đơn, một lệnh Cut cho văn bản sẽ đi đến một phần của một hệ thống và một lệnh Cut cho một hình ảnh sẽ được xử lý ở những nơi khác.

TheCommand lớp tạo các giao diện giữa các Clientand theReceivers. Trong một
đối tượng Command, yêu cầu theClient của được công bố và kết hợp với các hoạt động tương ứng khả thi trong aReceiver. Cũng có thể là một tình trạng mà các Clientwants để truyền lại cho theReceiver, và điều này phải được cho phép. Các Invokeris có để xa theClientfrom theReceiver.
Nói đơn giản, theClientissues một cuộc gọi đến Executein các Invoker, và yêu cầu đi vào Commandand sau đó toActionin các nhận. Trong một chương trình, có thể có nhiều yêu cầu của các loại khác nhau đang được chuyển đến Bộ thu khác nhau. TheICommandinterface đảm bảo rằng tất cả họ đều phù hợp với một dạng chuẩn. Các cầu thủ trong mô hình này là:
Khách hàng
Tạo và executesCommands
ICommand
Một giao diện mà xác định theExecuteoperation
Invoker
Hỏi các theCommandto thực hiện theAction
lệnh
Một lớp mà thực hiện theExecuteoperation bằng cách gọi các hoạt động trên
Receiver
Receiver
Bất kỳ lớp học mà có thể thực hiện các requiredAction
hành động
Các hoạt động mà cần phải được thực hiện
các mẫu Command dường như có nhiều cầu thủ, nhưng một số trong số họ rơi ra khi các đại biểu được sử dụng, như thể hiện trong phần tiếp theo. Các khía cạnh khác của thiết kế là:
• Các lệnh có thể được lắp ráp thành các lệnh composite trong theCommandclass.
• lệnh mới có thể được thêm vào mà không làm phiền những cái hiện có.
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2025 I Love Translation. All reserved.

E-mail: