|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Provides a way to visit all children of an INode
instance.
This is the Visitor
of the Visitor design pattern.
Visits the children in insertion order. The default implementation performs
a shallow operation, visiting this INode
instance's children
and no further child generations.
Example:
Print the children, in insertion order, of the INode
instance
being visited. As this example shows, it is often convenient to implement
the visitor as an anonymous inner class.
IGraphVisitor visitor = new IGraphVisitor () { public boolean visit( INode aNode ) { System.out.println( aNode ); return true; } }; node.acceptVisitor( visitor );
INode
Method Summary | |
boolean |
visit(INode aElement)
Invoked during a visit by an INode instance during its
acceptVisitor method. |
Method Detail |
public boolean visit(INode aElement)
INode
instance during its
acceptVisitor
method. The specified parameter identifies what
we are currently visiting: a specific child, of that INode
instance. The returned boolean value can be used to end the visit early.
This can be useful to avoid unnecessary effort when searching for a
specific child, for instance, and that child is located early before
reaching the list of children.aElement
- a child of the visited INode
instance.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |