/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package parser; import java.util.HashMap; public class SimpleNode implements Node { protected Node parent; protected Node[] children; protected int id; protected Object value; protected SparcTranslator parser; public String image; int beginLine; int beginColumn; public SimpleNode(int i) { id = i; } public SimpleNode(SparcTranslator p, int i) { this(i); parser = p; } public void jjtOpen() { } public void jjtClose() { } public void jjtSetParent(Node n) { parent = n; } public Node jjtGetParent() { return parent; } public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node c[] = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; ((SimpleNode)n).parent=this; } public void removerightMostChild() { Node c[]=new Node[children.length-1]; System.arraycopy(children, 0, c, 0, children.length-1); children=c; } public void removeIthChild(int i) { this.children[i]=null; Node c[]=new Node[children.length-1]; if(i>0) System.arraycopy(children, 0, c, 0, i); if(i+1<children.length) System.arraycopy(children,i+1,c,i,children.length-(i+1)); children=c; } public void jjtAddNodeInside(Node n,int i) { if (children == null) { children = new Node[i + 1]; } else{ Node c[] = new Node[Math.max(children.length + 1,i+1)]; System.arraycopy(children,0,c,0,Math.max(i,children.length)); if(children.length>i) { System.arraycopy(children,i,c,i+1, children.length-i); } children = c; } children[i] = n; ((SimpleNode)n).parent=this; } public Node jjtGetChild(int i) { return children[i]; } public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } public void jjtSetValue(Object value) { this.value = value; } public Object jjtGetValue() { return value; } /** Accept the visitor. **/ public Object jjtAccept(SparcTranslatorVisitor visitor, Object data) { return visitor.visit(this, data); } /** Accept the visitor. **/ public Object childrenAccept(SparcTranslatorVisitor visitor, Object data) { if (children != null) { for (int i = 0; i < children.length; ++i) { children[i].jjtAccept(visitor, data); } } return data; } /* You can override these two methods in subclasses of SimpleNode to customize the way the node appears when the tree is dumped. If your output uses more than one line you should override toString(String), otherwise overriding toString() is probably all you need to do. */ public String toString() { return SparcTranslatorTreeConstants.jjtNodeName[id]+" " +((this.image==null)? "" : this.image); } public String toString(String prefix) { return prefix + toString(); } /* Override this method if you want to customize how the node dumps out its children. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode)children[i]; if (n != null) { n.dump(prefix + " "); } } } } public int getBeginLine() { return beginLine; } public int getBeginColumn() { return beginColumn; } public int getId() { return this.id; } public void removeChildren() { this.children=null; } public SparcTranslator getTranslator() { return parser; } public String toString(boolean useOriginalImages) { // TODO Auto-generated method stub return toString(); } public String toString(HashMap<String, String> sortRenaming) { throw new UnsupportedOperationException(); } } /* JavaCC - OriginalChecksum=fcf44562a71a90fa29a0d2840e7769c5 (do not edit this line) */