org.mozilla.javascript.Node.addChildAfter()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 JavaScript  
字(7.8k)|赞(0)|评价(0)|浏览(145)

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

Node.addChildAfter介绍

[英]Add 'child' after 'node'.
[中]在“节点”之后添加“子节点”。

代码示例

代码示例来源:origin: rhino/js

/**
 * Add 'child' before 'node'.
 */
public void addChildBefore(Node newChild, Node node) {
  if (newChild.next != null)
    throw new RuntimeException(
         "newChild had siblings in addChildBefore");
  if (first == node) {
    newChild.next = first;
    first = newChild;
    return;
  }
  Node prev = getChildBefore(node);
  addChildAfter(newChild, prev);
}

代码示例来源:origin: geogebra/geogebra

/**
 * Add 'child' before 'node'.
 */
public void addChildBefore(Node newChild, Node node) {
  if (newChild.next != null)
    throw new RuntimeException(
         "newChild had siblings in addChildBefore");
  if (first == node) {
    newChild.next = first;
    first = newChild;
    return;
  }
  Node prev = getChildBefore(node);
  addChildAfter(newChild, prev);
}

代码示例来源:origin: com.github.tntim96/rhino

/**
 * Add 'child' before 'node'.
 */
public void addChildBefore(Node newChild, Node node) {
  if (newChild.next != null)
    throw new RuntimeException(
         "newChild had siblings in addChildBefore");
  if (first == node) {
    newChild.next = first;
    first = newChild;
    return;
  }
  Node prev = getChildBefore(node);
  addChildAfter(newChild, prev);
}

代码示例来源:origin: io.apigee/rhino

/**
 * Add 'child' before 'node'.
 */
public void addChildBefore(Node newChild, Node node) {
  if (newChild.next != null)
    throw new RuntimeException(
         "newChild had siblings in addChildBefore");
  if (first == node) {
    newChild.next = first;
    first = newChild;
    return;
  }
  Node prev = getChildBefore(node);
  addChildAfter(newChild, prev);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

/**
 * Add 'child' before 'node'.
 */
public void addChildBefore(Node newChild, Node node) {
  if (newChild.next != null)
    throw new RuntimeException(
         "newChild had siblings in addChildBefore");
  if (first == node) {
    newChild.next = first;
    first = newChild;
    return;
  }
  Node prev = getChildBefore(node);
  addChildAfter(newChild, prev);
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

/**
 * Add 'child' before 'node'.
 */
public void addChildBefore(Node newChild, Node node) {
  if (newChild.next != null)
    throw new RuntimeException(
         "newChild had siblings in addChildBefore");
  if (first == node) {
    newChild.next = first;
    first = newChild;
    return;
  }
  Node prev = getChildBefore(node);
  addChildAfter(newChild, prev);
}

代码示例来源:origin: rhino/js

private static Node addBeforeCurrent(Node parent, Node previous,
                   Node current, Node toAdd)
{
  if (previous == null) {
    if (!(current == parent.getFirstChild())) Kit.codeBug();
    parent.addChildToFront(toAdd);
  } else {
    if (!(current == previous.getNext())) Kit.codeBug();
    parent.addChildAfter(toAdd, previous);
  }
  return toAdd;
}

代码示例来源:origin: geogebra/geogebra

private static Node addBeforeCurrent(Node parent, Node previous,
                   Node current, Node toAdd)
{
  if (previous == null) {
    if (!(current == parent.getFirstChild())) Kit.codeBug();
    parent.addChildToFront(toAdd);
  } else {
    if (!(current == previous.getNext())) Kit.codeBug();
    parent.addChildAfter(toAdd, previous);
  }
  return toAdd;
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

private static Node addBeforeCurrent(Node parent, Node previous,
                   Node current, Node toAdd)
{
  if (previous == null) {
    if (!(current == parent.getFirstChild())) Kit.codeBug();
    parent.addChildToFront(toAdd);
  } else {
    if (!(current == previous.getNext())) Kit.codeBug();
    parent.addChildAfter(toAdd, previous);
  }
  return toAdd;
}

代码示例来源:origin: ro.isdc.wro4j/rhino

private static Node addBeforeCurrent(Node parent, Node previous,
                   Node current, Node toAdd)
{
  if (previous == null) {
    if (!(current == parent.getFirstChild())) Kit.codeBug();
    parent.addChildToFront(toAdd);
  } else {
    if (!(current == previous.getNext())) Kit.codeBug();
    parent.addChildAfter(toAdd, previous);
  }
  return toAdd;
}

代码示例来源:origin: io.apigee/rhino

private static Node addBeforeCurrent(Node parent, Node previous,
                   Node current, Node toAdd)
{
  if (previous == null) {
    if (!(current == parent.getFirstChild())) Kit.codeBug();
    parent.addChildToFront(toAdd);
  } else {
    if (!(current == previous.getNext())) Kit.codeBug();
    parent.addChildAfter(toAdd, previous);
  }
  return toAdd;
}

代码示例来源:origin: com.github.tntim96/rhino

private static Node addBeforeCurrent(Node parent, Node previous,
                   Node current, Node toAdd)
{
  if (previous == null) {
    if (!(current == parent.getFirstChild())) Kit.codeBug();
    parent.addChildToFront(toAdd);
  } else {
    if (!(current == previous.getNext())) Kit.codeBug();
    parent.addChildAfter(toAdd, previous);
  }
  return toAdd;
}

代码示例来源:origin: ro.isdc.wro4j/rhino

private void closeSwitch(Node switchBlock)
{
  if (switchBlock.getType() != Token.BLOCK) throw Kit.codeBug();
  Jump switchNode = (Jump)switchBlock.getFirstChild();
  if (switchNode.getType() != Token.SWITCH) throw Kit.codeBug();
  Node switchBreakTarget = Node.newTarget();
  // switchNode.target is only used by NodeTransformer
  // to detect switch end
  switchNode.target = switchBreakTarget;
  Node defaultTarget = switchNode.getDefault();
  if (defaultTarget == null) {
    defaultTarget = switchBreakTarget;
  }
  switchBlock.addChildAfter(makeJump(Token.GOTO, defaultTarget),
               switchNode);
  switchBlock.addChildToBack(switchBreakTarget);
}

代码示例来源:origin: geogebra/geogebra

private void closeSwitch(Node switchBlock)
{
  if (switchBlock.getType() != Token.BLOCK) throw Kit.codeBug();
  Jump switchNode = (Jump)switchBlock.getFirstChild();
  if (switchNode.getType() != Token.SWITCH) throw Kit.codeBug();
  Node switchBreakTarget = Node.newTarget();
  // switchNode.target is only used by NodeTransformer
  // to detect switch end
  switchNode.target = switchBreakTarget;
  Node defaultTarget = switchNode.getDefault();
  if (defaultTarget == null) {
    defaultTarget = switchBreakTarget;
  }
  switchBlock.addChildAfter(makeJump(Token.GOTO, defaultTarget),
               switchNode);
  switchBlock.addChildToBack(switchBreakTarget);
}

代码示例来源:origin: rhino/js

void closeSwitch(Node switchBlock)
{
  if (switchBlock.getType() != Token.BLOCK) throw Kit.codeBug();
  Node.Jump switchNode = (Node.Jump)switchBlock.getFirstChild();
  if (switchNode.getType() != Token.SWITCH) throw Kit.codeBug();
  Node switchBreakTarget = Node.newTarget();
  // switchNode.target is only used by NodeTransformer
  // to detect switch end
  switchNode.target = switchBreakTarget;
  Node defaultTarget = switchNode.getDefault();
  if (defaultTarget == null) {
    defaultTarget = switchBreakTarget;
  }
  switchBlock.addChildAfter(makeJump(Token.GOTO, defaultTarget),
               switchNode);
  switchBlock.addChildToBack(switchBreakTarget);
}

代码示例来源:origin: io.apigee/rhino

private void closeSwitch(Node switchBlock)
{
  if (switchBlock.getType() != Token.BLOCK) throw Kit.codeBug();
  Jump switchNode = (Jump)switchBlock.getFirstChild();
  if (switchNode.getType() != Token.SWITCH) throw Kit.codeBug();
  Node switchBreakTarget = Node.newTarget();
  // switchNode.target is only used by NodeTransformer
  // to detect switch end
  switchNode.target = switchBreakTarget;
  Node defaultTarget = switchNode.getDefault();
  if (defaultTarget == null) {
    defaultTarget = switchBreakTarget;
  }
  switchBlock.addChildAfter(makeJump(Token.GOTO, defaultTarget),
               switchNode);
  switchBlock.addChildToBack(switchBreakTarget);
}

代码示例来源:origin: com.github.tntim96/rhino

private void closeSwitch(Node switchBlock)
{
  if (switchBlock.getType() != Token.BLOCK) throw Kit.codeBug();
  Jump switchNode = (Jump)switchBlock.getFirstChild();
  if (switchNode.getType() != Token.SWITCH) throw Kit.codeBug();
  Node switchBreakTarget = Node.newTarget();
  // switchNode.target is only used by NodeTransformer
  // to detect switch end
  switchNode.target = switchBreakTarget;
  Node defaultTarget = switchNode.getDefault();
  if (defaultTarget == null) {
    defaultTarget = switchBreakTarget;
  }
  switchBlock.addChildAfter(makeJump(Token.GOTO, defaultTarget),
               switchNode);
  switchBlock.addChildToBack(switchBreakTarget);
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

void closeSwitch(Node switchBlock)
{
  if (switchBlock.getType() != Token.BLOCK) throw Kit.codeBug();
  Node.Jump switchNode = (Node.Jump)switchBlock.getFirstChild();
  if (switchNode.getType() != Token.SWITCH) throw Kit.codeBug();
  Node switchBreakTarget = Node.newTarget();
  // switchNode.target is only used by NodeTransformer
  // to detect switch end
  switchNode.target = switchBreakTarget;
  Node defaultTarget = switchNode.getDefault();
  if (defaultTarget == null) {
    defaultTarget = switchBreakTarget;
  }
  switchBlock.addChildAfter(makeJump(Token.GOTO, defaultTarget),
               switchNode);
  switchBlock.addChildToBack(switchBreakTarget);
}

相关文章

微信公众号