01 /* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */
02 /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
03 package com.javadoq.javadoc;
04 
05 public
06 class SimpleNode implements Node {
07 
08   protected Node parent;
09   protected Node[] children;
10   protected int id;
11   protected Object value;
12   protected JavadocParser parser;
13 
14   public SimpleNode(int i) {
15     id = i;
16   }
17 
18   public SimpleNode(JavadocParser p, int i) {
19     this(i);
20     parser = p;
21   }
22 
23   public void jjtOpen() {
24   }
25 
26   public void jjtClose() {
27   }
28 
29   public void jjtSetParent(Node n) { parent = n; }
30   public Node jjtGetParent() { return parent; }
31 
32   public void jjtAddChild(Node n, int i) {
33     if (children == null) {
34       children = new Node[i + 1];
35     } else if (i >= children.length) {
36       Node c[] = new Node[i + 1];
37       System.arraycopy(children, 0, c, 0, children.length);
38       children = c;
39     }
40     children[i] = n;
41   }
42 
43   public Node jjtGetChild(int i) {
44     return children[i];
45   }
46 
47   public int jjtGetNumChildren() {
48     return (children == null) ? 0 : children.length;
49   }
50 
51   public void jjtSetValue(Object value) { this.value = value; }
52   public Object jjtGetValue() { return value; }
53 
54   /* You can override these two methods in subclasses of SimpleNode to
55      customize the way the node appears when the tree is dumped.  If
56      your output uses more than one line you should override
57      toString(String), otherwise overriding toString() is probably all
58      you need to do. */
59 
60   public String toString() { return JavadocParserTreeConstants.jjtNodeName[id]; }
61   public String toString(String prefix) { return prefix + toString(); }
62 
63   /* Override this method if you want to customize how the node dumps
64      out its children. */
65 
66   public void dump(String prefix) {
67     System.out.println(toString(prefix));
68     if (children != null) {
69       for (int i = 0; i < children.length; ++i) {
70         SimpleNode n = (SimpleNode)children[i];
71         if (n != null) {
72           n.dump(prefix + " ");
73         }
74       }
75     }
76   }
77 }