1 package org.hibernate.hql.ast.tree; 3 4 import java.util.ArrayList ; 5 6 import org.hibernate.hql.antlr.SqlTokenTypes; 7 import org.hibernate.hql.ast.util.ASTPrinter; 8 9 import antlr.collections.AST; 10 11 16 public abstract class SelectExpressionList extends HqlSqlWalkerNode { 17 22 public SelectExpression[] collectSelectExpressions() { 23 AST firstChild = getFirstSelectExpression(); 26 AST parent = this; 27 ArrayList list = new ArrayList ( parent.getNumberOfChildren() ); 28 for ( AST n = firstChild; n != null; n = n.getNextSibling() ) { 29 if ( n instanceof SelectExpression ) { 30 list.add( n ); 31 } 32 else { 33 throw new IllegalStateException ( "Unexpected AST: " + n.getClass().getName() + " " + new ASTPrinter( SqlTokenTypes.class ).showAsString( n, "" ) ); 34 } 35 } 36 return ( SelectExpression[] ) list.toArray( new SelectExpression[list.size()] ); 37 } 38 39 46 protected abstract AST getFirstSelectExpression(); 47 48 } 49 | Popular Tags |