Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SimpleNode.java

00001 package edu.ksu.cis.bandera.abstraction.predicate.parser;
00002 
00003 /* Generated By:JJTree: Do not edit this line. SimpleNode.java */
00004 public class SimpleNode implements Node {
00005   protected Node parent;
00006   protected Node[] children;
00007   protected int id;
00008   protected PredicateParser parser;
00009 
00010   // Added attribute begin
00011   protected String tag;
00012   // Added code end
00013 
00014   public SimpleNode(int i) {
00015     id = i;
00016   }  
00017   public SimpleNode(PredicateParser p, int i) {
00018     this(i);
00019     parser = p;
00020   }  
00021   /** Accept the visitor. **/
00022   public Object childrenAccept(PredicateParserVisitor visitor, Object data) {
00023     if (children != null) {
00024       for (int i = 0; i < children.length; ++i) {
00025         children[i].jjtAccept(visitor, data);
00026       }
00027     }
00028     return data;
00029   }  
00030   /* Override this method if you want to customize how the node dumps
00031      out its children. */
00032 
00033   public void dump(String prefix) {
00034     System.out.println(toString(prefix));
00035     if (children != null) {
00036       for (int i = 0; i < children.length; ++i) {
00037     SimpleNode n = (SimpleNode)children[i];
00038     if (n != null) {
00039       n.dump(prefix + " ");
00040     }
00041       }
00042     }
00043   }  
00044   public String getTag() { return tag; }  
00045   /** Accept the visitor. **/
00046   public Object jjtAccept(PredicateParserVisitor visitor, Object data) {
00047     return visitor.visit(this, data);
00048   }  
00049   public void jjtAddChild(Node n) { jjtAddChild(n, jjtGetNumChildren()); }  
00050   public void jjtAddChild(Node n, int i) {
00051     if (children == null) {
00052       children = new Node[i + 1];
00053     } else if (i >= children.length) {
00054       Node c[] = new Node[i + 1];
00055       System.arraycopy(children, 0, c, 0, children.length);
00056       children = c;
00057     }
00058     children[i] = n;
00059   }  
00060   public void jjtClose() {
00061   }  
00062   public static Node jjtCreate(int id) {
00063     return new SimpleNode(id);
00064   }  
00065   public static Node jjtCreate(PredicateParser p, int id) {
00066     return new SimpleNode(p, id);
00067   }  
00068   public Node jjtGetChild(int i) {
00069     return children[i];
00070   }  
00071   public int jjtGetNumChildren() {
00072     return (children == null) ? 0 : children.length;
00073   }  
00074   public Node jjtGetParent() { return parent; }  
00075   public void jjtOpen() {
00076   }  
00077   public void jjtSetParent(Node n) { parent = n; }  
00078   // Added attribute end
00079 
00080   // Added code begin
00081   public void setTag(String s) { tag = s; }  
00082   /* You can override these two methods in subclasses of SimpleNode to
00083      customize the way the node appears when the tree is dumped.  If
00084      your output uses more than one line you should override
00085      toString(String), otherwise overriding toString() is probably all
00086      you need to do. */
00087 
00088   public String toString() { return PredicateParserTreeConstants.jjtNodeName[id]; }  
00089   public String toString(String prefix) { return prefix + toString(); }  
00090 }

Generated at Thu Feb 7 06:54:55 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001