FileDocCategorySizeDatePackage
ASTIterator.javaAPI DocHibernate 3.2.51257Tue Jul 12 15:27:30 BST 2005org.hibernate.hql.ast.util

ASTIterator

public class ASTIterator extends Object implements Iterator
Depth first iteration of an ANTLR AST.
author
josh Sep 25, 2004 7:44:39 AM

Fields Summary
private antlr.collections.AST
next
private antlr.collections.AST
current
private LinkedList
parents
Constructors Summary
public ASTIterator(antlr.collections.AST tree)

		next = tree;
		down();
	
Methods Summary
private voiddown()

		while ( next != null && next.getFirstChild() != null ) {
			push( next );
			next = next.getFirstChild();
		}
	
public booleanhasNext()

		return next != null;
	
public java.lang.Objectnext()

		return nextNode();
	
public antlr.collections.ASTnextNode()

		current = next;
		if ( next != null ) {
			AST nextSibling = next.getNextSibling();
			if ( nextSibling == null ) {
				next = pop();
			}
			else {
				next = nextSibling;
				down();
			}
		}
		return current;
	
private antlr.collections.ASTpop()

		if ( parents.size() == 0 ) {
			return null;
		}
		else {
			return ( AST ) parents.removeFirst();
		}
	
private voidpush(antlr.collections.AST parent)

		parents.addFirst( parent );
	
public voidremove()


	   
		throw new UnsupportedOperationException( "remove() is not supported" );