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


Java CommonTree.addChild方法代码示例

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


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

示例1: patchTreeByTreesGroupBy

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
public static void patchTreeByTreesGroupBy(CommonTree srcTree, CommonTree targetTree)
{
    //System.out.println("Text = " + srcTree.getText() +  " ChildCount = " + srcTree.getChildCount() + " Type = " + srcTree.getType());
    if (srcTree.getChildCount() == 0) {
        return;
    }

    // process node
	if (srcTree.getText().equals(QUERY_SPEC_NODE)) {
		// patch
		targetTree.setParent(srcTree);
		srcTree.addChild(targetTree);
		return;
	}

    // process children
    for (Tree t : children(srcTree)) {
        patchTreeByTreesGroupBy((CommonTree)t, targetTree);
    }

    return;
}
 
开发者ID:ajoabraham,项目名称:hue,代码行数:23,代码来源:TreePatcher.java

示例2: createGroupByNode

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
public static CommonTree createGroupByNode(List<String> names)
{
	CommonTree groupByNode = createGenericNode(GENERIC_NODE);
	groupByNode.token.setText(GROUP_BY_NODE);
	//groupByNode.token.setType(80);
	groupByNode.token.setType(findType(GROUP_BY_NODE));
	groupByNode.deleteChild(0);

	for (String name : names) {
		CommonTree genericNode = createGenericNode(name);
		genericNode.setParent(groupByNode);
		groupByNode.addChild(genericNode);
	}

	return groupByNode;
}
 
开发者ID:ajoabraham,项目名称:hue,代码行数:17,代码来源:TreePatcher.java

示例3: patchTreeByTree

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
public static void patchTreeByTree(CommonTree srcTree, String target, CommonTree goalTree)
{
    if (srcTree.getChildCount() == 0) {
        // leaf
		//System.out.println("leaf " + srcTree.getToken().getText());
		if (srcTree.getToken().getText().equals(target)) {
			srcTree.deleteChild(0);
			srcTree.addChild(goalTree);
			System.out.println("Found 1!!!");
		}
		return;
    }

    // process node
    System.out.println("node " + srcTree.getToken().getText());
    if (srcTree.getToken().getText().equals(target)) {
		srcTree.deleteChild(0);
		srcTree.addChild(goalTree);
		//System.out.println("Found 2!!!");
    }

    // process children
    for (Tree t : children(srcTree)) {
        patchTreeByTree((CommonTree)t, target, goalTree);
    }

    return;
}
 
开发者ID:ajoabraham,项目名称:hue,代码行数:29,代码来源:TreePatcher.java

示例4: 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


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