Visitor Cycles
The ProcessComponent hierarchy that Oozinoz uses to model process flows is another composite structure that can benefit from building in support for VISITOR. Unlike machine composites, it is natural for process flows to contain cycles, and visitors must take care not to cause infinite loops while traversing process composites. Figure 29.5 shows the Process-Component hierarchy.
Figure 29.5. Like the MachineComponent hierarchy, the ProcessComponent hierarchy can build in support for Visitor.
Suppose that you want to print out a process component in a “pretty,” or indented, format. In Chapter 28, Iterator, you used an iterator to print ...
Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.