net.paulhertz.aifile
Interface Visitable

All Known Implementing Classes:
BezCircle, BezCurve, BezCurveShape, BezEllipse, BezLine, BezMultiCurve, BezMultiLine, BezPoly, BezRectangle, BezRegularPoly, BezShape, BezTriangle, CustomComponent, DisplayComponent, DocumentComponent, GroupComponent, LayerComponent, PointText

public interface Visitable

Interface for display components that implement the Visitor design pattern.

The Visitor design pattern represents operations to be performed on the elements of an object structure. The pattern encapsulates operations into methods separate from the structure, which only needs to accept the visitor and allow it to access its state, generally by passing back a reference to itself to an overloaded method tailored to the class of the visited instance.

abstract class for Visitors.


Method Summary
 void accept(ComponentVisitor visitor)
          Accepts a ComponentVisitor that traverses a document structure tree.
 void accept(ComponentVisitor visitor, boolean order)
          Accepts a ComponentVisitor that traverses a document structure tree in preorder or postorder.
 

Method Detail

accept

void accept(ComponentVisitor visitor)
Accepts a ComponentVisitor that traverses a document structure tree.

When called from an object that implements the Visitable interface:

  1. each visited object passes a reference to itself back to the visitor
  2. each visited object calls accept( visitor ) on all its children

The reference is passed back to the visitor through a method of the form visitor.visit<ComponentClassName>( this ); See ComponentVisitor

The order of steps 1 and 2 determines if traversal of the composite structure is preorder or postorder. As shown above, it's preorder. Depending on what you want to do, one traversal may be better suited than the other. Preorder visits parents first, postorder visits children first.

Parameters:
visitor - a ComponentVisitor

accept

void accept(ComponentVisitor visitor,
            boolean order)
Accepts a ComponentVisitor that traverses a document structure tree in preorder or postorder.

Parameters:
visitor - a ComponentVisitor
order - boolean to determine if traversal is preorder or postorder accept( visitor ) should implement the default order of traversal, accept( visitor, <false> ) should implement the other order.


Processing library IgnoCodeLib by Paul Hertz. (C) 2013