O'Reilly logo

Design Patterns Java™ Workbook by Steven John Metsker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required