Hilbert II - Version 0.01.09

org.qedeq.kernel.base.elli
Interface Visitor


public interface Visitor

The visitor design pattern is a way of separating an algorithm from an object structure. A practical result of this separation is the ability to add new operations to existing object structures without modifying those structures. The idea is to use a structure of element classes, each of which has an accept method that takes a visitor object as an argument. The visitor is an interface that has a different visit() method for each element class. The accept() method of an element class calls back the visit() method for its class. Separate concrete visitor classes can then be written that perform some particular operations. One of these visit() methods of a concrete visitor can be thought of as methods not of a single class, but rather methods of a pair of classes: the concrete visitor and the particular element class. Thus the visitor pattern simulates double dispatch in a conventional single-dispatch object-oriented language such as Java.

The visitor pattern also specifies how iteration occurs over the object structure. In the simplest version, where each algorithm needs to iterate in the same way, the accept() method of a container element, in addition to calling back the visit() method of the visitor, also passes the visitor object to the accept() method of all its constituent child elements.

See Wikepedia article.

Version:
$Revision: 1.1 $

Method Summary
 void visit(Atom atom)
          Visit certain element.
 void visit(ElementList list)
          Visit certain element.
 

Method Detail

visit

public void visit(Atom atom)
Visit certain element.

Parameters:
atom - Visit this element.

visit

public void visit(ElementList list)
Visit certain element.

Parameters:
list - Visit this element.

Hilbert II - Version 0.01.09

©left GNU General Public Licence
All Rights Reserved.