当前位置: 首页>>代码示例>>Java>>正文


Java CommonTree.getChildren方法代码示例

本文整理汇总了Java中org.antlr.runtime.tree.CommonTree.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java CommonTree.getChildren方法的具体用法?Java CommonTree.getChildren怎么用?Java CommonTree.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.antlr.runtime.tree.CommonTree的用法示例。


在下文中一共展示了CommonTree.getChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: combineNames

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static String combineNames(CommonTree node) {
    List<Tree> children = node.getChildren();
    List<String> names = new ArrayList<String>();
    for (Tree child : children) {
        names.add(child.getText());
    }
    Joiner joiner = Joiner.on(".").skipNulls();

    return joiner.join(names);
}
 
开发者ID:ajoabraham,项目名称:hue,代码行数:11,代码来源:TreePatcher.java

示例2: isAutoPhrasable

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static boolean isAutoPhrasable(CommonTree node, boolean defaultConjunction) {
	if((node.getType() == FTSParser.CONJUNCTION) && (node.getChildCount() > 1))
	{
		int simpleTermCount = 0;
		for (Object current : node.getChildren())
		{
			CommonTree child = (CommonTree) current;
			if((child.getType() ==  FTSParser.MANDATORY) || (child.getType() ==  FTSParser.DEFAULT))
			{
				if(child.getChildCount() > 0)
				{
					CommonTree item = (CommonTree)child.getChild(0);
					if((item.getType() == FTSParser.TERM) && (item.getChildCount() == 1))
					{
						simpleTermCount++;
					}
				}
			}
			else
			{
				return false;
			}
		}
		return simpleTermCount > 1;
	}

	return false;

}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:30,代码来源:FTSQueryParser.java

示例3: copy

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
static private CommonTree copy(CommonTree source)
{
    CommonTree newNode = new CommonTree(source);
    if (source.getChildCount() > 0)
    {
        for (Object current : source.getChildren())
        {
            CommonTree child = (CommonTree) current;
            CommonTree newChild = copy(child);
            newNode.addChild(newChild);
        }
    }
    return newNode;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:15,代码来源:FTSQueryParser.java

示例4: print

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static void print(CommonTree tree, int level) {
	//indent level
	for (int i = 0; i < level; i++)
		logger.debug("--");

	//print node description: type code followed by token text
	logger.debug(" " + tree.getType() + " " + tree.getText());
	
	//print all children
	if (tree.getChildren() != null)
		for (Object ie : tree.getChildren()) {
			print((CommonTree) ie, level + 1);
		}
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:15,代码来源:WhereCompiler.java

示例5: getChildNodes

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static List<CommonTree> getChildNodes(CommonTree node) {
 return node.getChildren();
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:5,代码来源:SQLParserUtil.java

示例6: getClause

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
/**
 * Gets the clause specificed in paramName
 *
 * @param param
 * @param paramName
 * @return bean property names potentially using JSON Pointer syntax
 */
default List<String> getClause(String param, String paramName)
{
    if (param == null)
        return Collections.emptyList();

    try
    {
        CommonTree selectedPropsTree = WhereCompiler.compileSelectClause(param);
        if (selectedPropsTree instanceof CommonErrorNode)
        {
            rpeLogger().debug("Error parsing the " + paramName + " clause " + selectedPropsTree);
            throw new InvalidSelectException(paramName, selectedPropsTree);
        }
        if (selectedPropsTree.getChildCount() == 0 && !selectedPropsTree.getText().isEmpty())
        {
            return Arrays.asList(selectedPropsTree.getText());
        }
        List<Tree> children = (List<Tree>) selectedPropsTree.getChildren();
        if (children != null && !children.isEmpty())
        {
            List<String> properties = new ArrayList<String>(children.size());
            for (Tree child : children)
            {
                properties.add(child.getText());
            }
            return properties;
        }
    }
    catch (RewriteCardinalityException re)
    {
        //Catch any error so it doesn't get thrown up the stack
        rpeLogger().debug("Unhandled Error parsing the " + paramName + " clause: " + re);
    }
    catch (RecognitionException e)
    {
        rpeLogger().debug("Error parsing the \"+paramName+\" clause: " + param);
    }
    catch (InvalidQueryException iqe)
    {
        throw new InvalidSelectException(paramName, iqe.getQueryParam());
    }
    //Default to throw out an invalid query
    throw new InvalidSelectException(paramName, param);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:52,代码来源:RecognizedParamsExtractor.java


注:本文中的org.antlr.runtime.tree.CommonTree.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。