org.antlr.runtime.tree.Tree.deleteChild()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中org.antlr.runtime.tree.Tree.deleteChild()方法的一些代码示例,展示了Tree.deleteChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.deleteChild()方法的具体详情如下:
包路径:org.antlr.runtime.tree.Tree
类名称:Tree
方法名:deleteChild

Tree.deleteChild介绍

暂无

代码示例

代码示例来源:origin: apache/hive

private static void removeASTChild(ASTNode node) {
 Tree parent = node.getParent();
 if (parent != null) {
  parent.deleteChild(node.getChildIndex());
  node.setParent(null);
 }
}

代码示例来源:origin: antlr/antlr3

@Override
public Object deleteChild(Object t, int i) {
  return ((Tree)t).deleteChild(i);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

@Override
public Object deleteChild(Object t, int i) {
  return ((Tree)t).deleteChild(i);
}

代码示例来源:origin: antlr/antlr3

@Override
public Object deleteChild(Object t, int i) {
  return ((Tree)t).deleteChild(i);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime

@Override
public Object deleteChild(Object t, int i) {
  return ((Tree)t).deleteChild(i);
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
public Object deleteChild(Object t, int i) {
  return ((Tree)t).deleteChild(i);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

public Object deleteChild(Object t, int i) {
  return ((Tree)t).deleteChild(i);
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

public boolean removeDistinct() {
  Tree selectedItems = queryTree.getAstSelectedItemsNode();
  boolean isDistinct = "distinct".equalsIgnoreCase(selectedItems.getChild(0).getText());
  if (isDistinct) {
    selectedItems.deleteChild(0);
    selectedItems.freshenParentAndChildIndexes();
  } else {
    return false;
  }
  return true;
}

代码示例来源:origin: org.apache.pig/pig

t.getParent().deleteChild(t.getChildIndex());
return;

代码示例来源:origin: com.google.code.byteseek/byteseek

treeNode.deleteChild(childIndex);

代码示例来源:origin: org.apache.pig/pig

stmtNode.deleteChild(defineNode.getChildIndex());

代码示例来源:origin: apache/lens

private void trimHavingAndOrderby(ASTNode ast, Cube innerCube) {
 ASTNode havingAst = HQLParser.findNodeByPath(ast, TOK_INSERT, TOK_HAVING);
 if (havingAst != null) {
  ASTNode newHavingAst = HQLParser.trimHavingAst(havingAst, innerCube.getAllFieldNames());
  if (newHavingAst != null) {
   havingAst.getParent().setChild(havingAst.getChildIndex(), newHavingAst);
  } else {
   havingAst.getParent().deleteChild(havingAst.getChildIndex());
  }
 }
 ASTNode orderByAst = HQLParser.findNodeByPath(ast, TOK_INSERT, TOK_ORDERBY);
 if (orderByAst != null) {
  ASTNode newOrderByAst = HQLParser.trimOrderByAst(orderByAst, innerCube.getAllFieldNames());
  if (newOrderByAst != null) {
   orderByAst.getParent().setChild(orderByAst.getChildIndex(), newOrderByAst);
  } else {
   orderByAst.getParent().deleteChild(orderByAst.getChildIndex());
  }
 }
}

代码示例来源:origin: org.apache.lens/lens-cube

private void trimHavingAndOrderby(ASTNode ast, Cube innerCube) {
 ASTNode havingAst = HQLParser.findNodeByPath(ast, TOK_INSERT, TOK_HAVING);
 if (havingAst != null) {
  ASTNode newHavingAst = HQLParser.trimHavingAst(havingAst, innerCube.getAllFieldNames());
  if (newHavingAst != null) {
   havingAst.getParent().setChild(havingAst.getChildIndex(), newHavingAst);
  } else {
   havingAst.getParent().deleteChild(havingAst.getChildIndex());
  }
 }
 ASTNode orderByAst = HQLParser.findNodeByPath(ast, TOK_INSERT, TOK_ORDERBY);
 if (orderByAst != null) {
  ASTNode newOrderByAst = HQLParser.trimOrderByAst(orderByAst, innerCube.getAllFieldNames());
  if (newOrderByAst != null) {
   orderByAst.getParent().setChild(orderByAst.getChildIndex(), newOrderByAst);
  } else {
   orderByAst.getParent().deleteChild(orderByAst.getChildIndex());
  }
 }
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

public void replaceWithCount(Tree node) {
  Tree selectedItems = queryTree.getAstSelectedItemsNode();
  boolean isDistinct = "distinct".equalsIgnoreCase(selectedItems.getChild(0).getText());
  if (!(isDistinct && selectedItems.getChildCount() == 2 ||
      selectedItems.getChildCount() == 1))
    throw new IllegalStateException("Cannot replace with count if multiple fields selected");
  SelectedItemNode selectedItemNode;
  if (isDistinct)
    selectedItems.deleteChild(0);
  selectedItemNode = (SelectedItemNode) selectedItems.getChild(0);
  AggregateExpressionNode countNode = createCountNode(node, isDistinct);
  selectedItemNode.deleteChild(0);
  selectedItemNode.addChild(countNode);
  Tree orderBy = queryTree.getAstTree().getFirstChildWithType(JPA2Lexer.T_ORDER_BY);
  if (orderBy != null) {
    queryTree.getAstTree().deleteChild(orderBy.getChildIndex());
  }
  queryTree.getAstTree().freshenParentAndChildIndexes();
}

相关文章