TUM CCSM Commons

edu.tum.cs.commons.visitor
Class VisitorUtils

java.lang.Object
  extended by edu.tum.cs.commons.visitor.VisitorUtils

public class VisitorUtils
extends java.lang.Object

Utility class for working with visitors.

Version:
$Rev: 26283 $
Author:
hummelb, $Author: juergens $
Rating:
GREEN Hash: 00BEBED1B01400AAA4E7790F22F6900B

Constructor Summary
VisitorUtils()
           
 
Method Summary
static
<T,X1 extends java.lang.Exception,X2 extends java.lang.Exception>
void
visitAllDepthFirst(T start, IMeshWalker<T,X1> walker, IVisitor<T,X2> visitor)
          Visits all elements of a mesh in depth first order.
static
<T,X1 extends java.lang.Exception,X2 extends java.lang.Exception>
void
visitAllPreOrder(T root, ITreeWalker<T,X1> walker, IVisitor<T,X2> visitor)
          Visits all nodes of a tree in pre-order, i.e. a node is visited directly before its children.
static
<T,X1 extends java.lang.Exception,X2 extends java.lang.Exception>
void
visitLeaves(T root, ITreeWalker<T,X1> walker, IVisitor<T,X2> visitor)
          Visits all leaves of a tree, i.e. those nodes without children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VisitorUtils

public VisitorUtils()
Method Detail

visitAllPreOrder

public static <T,X1 extends java.lang.Exception,X2 extends java.lang.Exception> void visitAllPreOrder(T root,
                                                                                                      ITreeWalker<T,X1> walker,
                                                                                                      IVisitor<T,X2> visitor)
                             throws X1 extends java.lang.Exception,
                                    X2 extends java.lang.Exception
Visits all nodes of a tree in pre-order, i.e. a node is visited directly before its children.

Parameters:
root - the root of the tree.
walker - the walker user for traversing the tree.
visitor - the visitor used for visiting the nodes.
Throws:
X1 extends java.lang.Exception

visitLeaves

public static <T,X1 extends java.lang.Exception,X2 extends java.lang.Exception> void visitLeaves(T root,
                                                                                                 ITreeWalker<T,X1> walker,
                                                                                                 IVisitor<T,X2> visitor)
                        throws X1 extends java.lang.Exception,
                               X2 extends java.lang.Exception
Visits all leaves of a tree, i.e. those nodes without children.

Parameters:
root - the root of the tree.
walker - the walker user for traversing the tree.
visitor - the visitor used for visiting the nodes.
Throws:
X1 extends java.lang.Exception

visitAllDepthFirst

public static <T,X1 extends java.lang.Exception,X2 extends java.lang.Exception> void visitAllDepthFirst(T start,
                                                                                                        IMeshWalker<T,X1> walker,
                                                                                                        IVisitor<T,X2> visitor)
                               throws X1 extends java.lang.Exception,
                                      X2 extends java.lang.Exception
Visits all elements of a mesh in depth first order. It is made sure, that each reachable element is visited exactly once, where we use equality of references to determine elements that were seen before.

Parameters:
start - the element to start the traversal from.
walker - the walker user for traversing the mesh.
visitor - the visitor used for visiting the elements.
Throws:
X1 extends java.lang.Exception

TUM CCSM Commons

TUM CCSM Commons - 2.7