Design Patterns Java™ Workbook
Chapter 29. Visitor Figure 29.2. This GUI application presents the composition of machines at the new factory in Dublin. There a ...
Chapter 29. Visitor Figure 29.3. The FindVisitor class effectively adds a find() operation to the MachineComponent hierarchy. Th ...
Chapter 29. Visitor public void visit(Machine m) { if (sought == null && m.getId() == soughtId) { sought = m; } } public ...
Chapter 29. Visitor Figure 29.4. A FindVisitor object calls a MachineComponent object's accept() method to determine which visit ...
Chapter 29. Visitor public void visit(Machine m) { ?? } public void visit(MachineComposite mc) { ?? } } CHALLENGE 29.3 Complete ...
Chapter 29. Visitor Visitor Cycles The ProcessComponent hierarchy that Oozinoz uses to model process flows is another composite ...
Chapter 29. Visitor To create a pretty-printer for processes, you can create a visitor class that initializes a StringBuffer obj ...
Chapter 29. Visitor protected void acceptChildren(ProcessComposite c) { Iterator i = c.getSubprocesses().iterator(); depth++; wh ...
Chapter 29. Visitor CHALLENGE 29.4 How can the ProcessComponent developers include support of cycle management in the hierarchy' ...
Chapter 29. Visitor CHALLENGE 29.5 List two alternatives to building VISITORinto the Oozinoz machine and process hierarchies. Su ...
Part VI: Appendixes................................................................................................ Part VI: App ...
Appendix A. Directions.......................................................................................................... ...
Appendix A. Directions A good goal is to be able to answer these questions without referring to this book. It is also good exerc ...
Appendix A. Directions Now, suppose that you have given yourself plenty of time and simply need to set your direction. Before le ...
Appendix B. Solutions........................................................................................................... ...
Appendix B. Solutions Introducing Extensions (Chapter 26) Decorator (Chapter 27) Iterator (Chapter 28) Visitor (Chapter 29) ...
Appendix B. Solutions Introducing Interfaces (Chapter 2)........................................................................ ...
Appendix B. Solutions For example, a class that implements the MouseMotionListener interface from java.awt.event must implement ...
Appendix B. Solutions Figure B.1. An anonymous subclass of WindowAdapter can provide a Window-Listener object that ignores all e ...
Appendix B. Solutions public static void listen(Frame f) { f.addWindowListener ( new WindowAdapter() { public void windowClosing ...
«
10
11
12
13
14
15
16
17
18
19
»
Free download pdf