本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例5: getChildNodes
import org.antlr.runtime.tree.CommonTree; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static List<CommonTree> getChildNodes(CommonTree node) {
return node.getChildren();
}
示例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);
}