Visitor
From CSSEMediaWiki
(Difference between revisions)
(→Description) |
(→Description) |
||
Line 6: | Line 6: | ||
The Visitor describes three distinct components: | The Visitor describes three distinct components: | ||
− | *Object Structure | + | *Object Structure - Provides a visitor with access to its elements. |
− | *Element | + | *Element - Accepts visits. |
− | *Visitor | + | *Visitor - Accesses an element to perform operations. |
Figure 1 graphically describes these Visitor pattern interactions. | Figure 1 graphically describes these Visitor pattern interactions. | ||
− | [[image:Visitor.JPG|frame|centre|'''Figure 1: A UML class diagram representing the Visitor structure''']] | + | [[image:Visitor.JPG|frame|centre|'''Figure 1: A [[UML]] [[Class diagram|class diagram]] representing the Visitor structure''']] |
Revision as of 12:27, 30 July 2008
Introduction
The Visitor is a behavioural pattern. It allows the designer to define new operations on an object structure and its elements, without modifying the object structure itself.
Description
The Visitor describes three distinct components:
- Object Structure - Provides a visitor with access to its elements.
- Element - Accepts visits.
- Visitor - Accesses an element to perform operations.
Figure 1 graphically describes these Visitor pattern interactions.