本文整理汇总了Java中antlr.collections.AST.getNumberOfChildren方法的典型用法代码示例。如果您正苦于以下问题:Java AST.getNumberOfChildren方法的具体用法?Java AST.getNumberOfChildren怎么用?Java AST.getNumberOfChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类antlr.collections.AST
的用法示例。
在下文中一共展示了AST.getNumberOfChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processWhereClause
import antlr.collections.AST; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected ProcessedWhereClause processWhereClause(AST whereClause) {
if ( whereClause.getNumberOfChildren() != 0 ) {
// If a where clause was specified in the update/delete query, use it to limit the
// returned ids here...
try {
SqlGenerator sqlGenerator = new SqlGenerator( sessionFactory );
sqlGenerator.whereClause( whereClause );
String userWhereClause = sqlGenerator.getSQL().substring( 7 ); // strip the " where "
List<ParameterSpecification> idSelectParameterSpecifications = sqlGenerator.getCollectedParameters();
return new ProcessedWhereClause( userWhereClause, idSelectParameterSpecifications );
}
catch ( RecognitionException e ) {
throw new HibernateException( "Unable to generate id select for DML operation", e );
}
}
else {
return ProcessedWhereClause.NO_WHERE_CLAUSE;
}
}
示例2: processEqualityExpression
import antlr.collections.AST; //导入方法依赖的package包/类
/**
* Post process equality expressions, clean up the subtree.
*
* @param x The equality expression.
*
* @return AST - The clean sub-tree.
*/
@Override
public AST processEqualityExpression(AST x) {
if ( x == null ) {
LOG.processEqualityExpression();
return null;
}
int type = x.getType();
if ( type == EQ || type == NE ) {
boolean negated = type == NE;
if ( x.getNumberOfChildren() == 2 ) {
AST a = x.getFirstChild();
AST b = a.getNextSibling();
// (EQ NULL b) => (IS_NULL b)
if ( a.getType() == NULL && b.getType() != NULL ) {
return createIsNullParent( b, negated );
}
// (EQ a NULL) => (IS_NULL a)
else if ( b.getType() == NULL && a.getType() != NULL ) {
return createIsNullParent( a, negated );
}
else if ( b.getType() == EMPTY ) {
return processIsEmpty( a, negated );
}
else {
return x;
}
}
else {
return x;
}
}
else {
return x;
}
}
示例3: hasWhereClause
import antlr.collections.AST; //导入方法依赖的package包/类
@Override
public final boolean hasWhereClause() {
AST whereClause = locateWhereClause();
return whereClause != null && whereClause.getNumberOfChildren() > 0;
}