本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例7: childAt
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
private static CommonTree childAt(int index, CommonTree node) {
return (CommonTree) node.getChild(index);
}
示例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);
}