FileDocCategorySizeDatePackage
NodeTraverser.javaAPI DocHibernate 3.2.5947Fri Feb 24 15:12:14 GMT 2006org.hibernate.hql.ast.util

NodeTraverser

public class NodeTraverser extends Object
A visitor for traversing an AST tree.
author
Steve Ebersole

Fields Summary
private final VisitationStrategy
strategy
Constructors Summary
public NodeTraverser(VisitationStrategy strategy)

		this.strategy = strategy;
	
Methods Summary
public voidtraverseDepthFirst(antlr.collections.AST ast)
Traverse the AST tree depth first.

Note that the AST passed in is not visited itself. Visitation starts with its children.

param
ast

		if ( ast == null ) {
			throw new IllegalArgumentException( "node to traverse cannot be null!" );
		}
		visitDepthFirst( ast.getFirstChild() );
	
private voidvisitDepthFirst(antlr.collections.AST ast)

		if ( ast == null ) {
			return;
		}
		strategy.visit( ast );
		visitDepthFirst( ast.getFirstChild() );
		visitDepthFirst( ast.getNextSibling() );