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


Java CommonTree.getChild方法代码示例

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


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

示例1: buildDisjunction

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
/**
 * @param orNode CommonTree
 * @param factory QueryModelFactory
 * @param functionEvaluationContext FunctionEvaluationContext
 * @param selectors Map<String, Selector>
 * @param columnMap HashMap<String, Column>
 * @return Constraint
 */
private Constraint buildDisjunction(CommonTree orNode, QueryModelFactory factory,
        FunctionEvaluationContext functionEvaluationContext, Map<String, Selector> selectors,
        HashMap<String, Column> columnMap)
{
    List<Constraint> constraints = new ArrayList<Constraint>(orNode.getChildCount());
    for (int i = 0; i < orNode.getChildCount(); i++)
    {
        CommonTree andNode = (CommonTree) orNode.getChild(i);
        Constraint constraint = buildConjunction(andNode, factory, functionEvaluationContext, selectors, columnMap);
        constraints.add(constraint);
    }
    if (constraints.size() == 1)
    {
        return constraints.get(0);
    } else
    {
        return factory.createDisjunction(constraints);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:28,代码来源:CMISQueryParser.java

示例2: buildConjunction

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
/**
 * @param andNode CommonTree
 * @param factory QueryModelFactory
 * @param functionEvaluationContext FunctionEvaluationContext
 * @param selectors Map<String, Selector>
 * @param columnMap HashMap<String, Column>
 * @return Constraint
 */
private Constraint buildConjunction(CommonTree andNode, QueryModelFactory factory,
        FunctionEvaluationContext functionEvaluationContext, Map<String, Selector> selectors,
        HashMap<String, Column> columnMap)
{
    List<Constraint> constraints = new ArrayList<Constraint>(andNode.getChildCount());
    for (int i = 0; i < andNode.getChildCount(); i++)
    {
        CommonTree notNode = (CommonTree) andNode.getChild(i);
        Constraint constraint = buildNegation(notNode, factory, functionEvaluationContext, selectors, columnMap);
        constraints.add(constraint);
    }
    if (constraints.size() == 1 && constraints.get(0).getOccur() != Occur.EXCLUDE)
    {
        return constraints.get(0);
    } else
    {
        return factory.createConjunction(constraints);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:28,代码来源:CMISQueryParser.java

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

示例4: setBoost

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
static private void setBoost(Constraint constraint, CommonTree subNode)
{
    for (int i = 0, l = subNode.getChildCount(); i < l; i++)
    {
        CommonTree child = (CommonTree) subNode.getChild(i);
        if (child.getType() == FTSParser.BOOST)
        {
            String boostString = child.getChild(0).getText();
            float boost = Float.parseFloat(boostString);
            constraint.setBoost(boost);
            return;
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:15,代码来源:FTSQueryParser.java

示例5: isStarWithNoField

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static boolean isStarWithNoField(CommonTree testNode)
{
    if (testNode.getType() == FTSParser.TERM && testNode.getChildCount() == 1)
    {
        CommonTree child = (CommonTree) testNode.getChild(0);
        if (child.getType() == FTSParser.STAR)
        {
            return true;
        }
    }
    return false;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:13,代码来源:FTSQueryParser.java

示例6: findFieldReference

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
static private CommonTree findFieldReference(CommonTree node)
{
    for (int i = 0, l = node.getChildCount(); i < l; i++)
    {
        CommonTree child = (CommonTree) node.getChild(i);
        if (child.getType() == FTSParser.FIELD_REF)
        {
            return child;
        }
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:13,代码来源:FTSQueryParser.java

示例7: childAt

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static CommonTree childAt(int index, CommonTree node) {
 return (CommonTree) node.getChild(index);
}
 
开发者ID:aravindc,项目名称:jdbacl,代码行数:4,代码来源:SQLParserUtil.java

示例8: buildFieldReference

import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
static public PropertyArgument buildFieldReference(String argumentName, CommonTree fieldReferenceNode, QueryModelFactory factory,
        FunctionEvaluationContext functionEvaluationContext, Selector selector, Map<String, Column> columnMap)
{
    if (fieldReferenceNode.getType() != FTSParser.FIELD_REF)
    {
        throw new FTSQueryException("Not column ref  ..." + fieldReferenceNode.getText());
    }
    String fieldName = getText(fieldReferenceNode.getChild(0));
    if (columnMap != null)
    {
        for (Column column : columnMap.values())
        {
            if (column.getAlias().equals(fieldName))
            {
                // TODO: Check selector matches ...
                PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
                fieldName = arg.getPropertyName();
                break;
            }
        }
    }

    // prepend prefixes and name spaces

    if (fieldReferenceNode.getChildCount() > 1)
    {
        CommonTree child = (CommonTree) fieldReferenceNode.getChild(1);
        if (child.getType() == FTSParser.PREFIX)
        {
            fieldName = getText(child.getChild(0)) + ":" + fieldName;
        }
        else if (child.getType() == FTSParser.NAME_SPACE)
        {
            fieldName = getText(child.getChild(0)) + fieldName;
        }
    }

    String alias = "";
    if (selector != null)
    {
        functionEvaluationContext.checkFieldApplies(selector, fieldName);
        alias = selector.getAlias();
    }

    return factory.createPropertyArgument(argumentName, functionEvaluationContext.isQueryable(fieldName), functionEvaluationContext.isOrderable(fieldName), alias, fieldName);
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:47,代码来源:FTSQueryParser.java


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