node.java

来自「有关编译器的编译器.」· Java 代码 · 共 79 行

JAVA
79
字号
/* This file was generated by SableCC (http://www.sablecc.org/). */package org.sablecc.sablecc.node;import java.util.*;import org.sablecc.sablecc.analysis.*;public abstract class Node implements Switchable, Cloneable{  private Node parent;  public abstract Object clone();  public Node parent()  {    return parent;  }  void parent(Node parent)  {    this.parent = parent;  }  abstract void removeChild(Node child);  abstract void replaceChild(Node oldChild, Node newChild);  public void replaceBy(Node node)  {    if(parent != null)    {      parent.replaceChild(this, node);    }  }  protected String toString(Node node)  {    if(node != null)    {      return node.toString();    }    return "";  }  protected String toString(List list)  {    StringBuffer s = new StringBuffer();    for(Iterator i = list.iterator(); i.hasNext();)    {      s.append(i.next());    }    return s.toString();  }  protected Node cloneNode(Node node)  {    if(node != null)    {      return (Node) node.clone();    }    return null;  }  protected List cloneList(List list)  {    List clone = new LinkedList();    for(Iterator i = list.iterator(); i.hasNext();)    {      clone.add(((Node) i.next()).clone());    }    return clone;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?