và Chuỗi Trách nhiệm cung cấp các quy tắc cho một số các thư được tuyên truyền. Ngoài ra, Composite có xu hướng để gửi tin nhắn "xuống" các Đây là ví dụ các cuộc gọi chỉ khi các phương pháp getAllAddresses Proxy sẽ tạo ra một đối tượng AddressBookImpl và lấy | 19. Deliverable deliverableOne new Deliverable Lunar landing module Ask the local garage if they can make a few minor modifications to one of their cars 2800 20. 21. Calculating the cost estimates using the Template Method getCostEstimate. 22. 23. Total cost estimate for primaryTask 24. t 25. 26. 27. Total cost estimate for deliverableOne 28. t 29. 30. 290 Structural Pattern Code Examples Adapter In this example the PIM uses an API provided by a foreign source. Two files represent the interface into a purchased set of classes intended to represent contacts. The basic operations are defined in the interface called Chovnatlh. Example 1. public interface Chovnatlh 2. public String tlhapWa DIchPong 3. public String tlhapQavPong 4. public String tlhapPatlh 5. public String tlhapGhom 6. 7. 8. 9. 10. public void cherWa DIchPong String chu wa DIchPong public void cherQavPong String chu QavPong public void cherPatlh String chu patlh public void cherGhom String chu ghom 11. The implementation for these methods is provided in the associated class ChovnatlhImpl. Example 1. pong name 2. wa DIch first 3. Qav last 4. patlh rank title 5. ghom group organization 6. tlhap take get 7. cher set up set 8. chu new 9. chovnatlh specimen contact 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. implements Chovnatlh public class ChovnatlhImpl implements Chovnatlh private String wa DIchPong fxCc private String QavPong private String patlh private String ghom public ChovnatlhImpl public ChovnatlhImpl String chu wa DIchPong String chu QavPong wa DIchPong String chu patlh String chu ghom wa DIchPong chu wa DIchPong QavPong chu QavPong patlh chu patlh ghom chu ghom public String .