/* $Id: Visitor.java,v 1.1 2005/08/14 06:48:25 m31 Exp $
 *
 * This file is part of the project "Hilbert II" - http://www.qedeq.org
 *
 * Copyright 2000-2005,  Michael Meyling <mime@qedeq.org>.
 *
 * "Hilbert II" is free software; you can redistribute
 * it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */

package org.qedeq.kernel.base.elli;

/**
 * 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 <code>visit()</code> method for each element class. The
 * <code>accept()</code> method of an element class calls back the <code>visit()</code> 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.
 * <p>
 * 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
 * <code>accept()</code> method of a container element, in addition to calling back the
 * <code>visit()</code> method of the visitor, also passes the visitor object to the
 * <code>accept()</code> method of all its constituent child elements.
 * <p>
 * See <a href="http://en.wikipedia.org/wiki/Visitor_pattern">Wikepedia article</a>.
 *
 * @version $Revision: 1.1 $
 * @author Michael Meyling
 */
public interface Visitor {

    /**
     * Visit certain element.
     *
     * @param atom  Visit this element.
     */
    public void visit(Atom atom);

    /**
     * Visit certain element.
     *
     * @param list  Visit this element.
     */
    public void visit(ElementList list);

}
