Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libGDBMS / src / com / hardcode / gdbms / parser / SimpleNode.java @ 466

History | View | Annotate | Download (2.16 KB)

1
package com.hardcode.gdbms.parser;
2
/* Generated By:JJTree: Do not edit this line. SimpleNode.java */
3

    
4
public class SimpleNode extends TokenSupport implements Node {
5
  protected Node parent;
6
  protected Node[] children;
7
  protected int id;
8
  protected SQLEngine parser;
9

    
10
  public SimpleNode(int i) {
11
    id = i;
12
  }
13

    
14
  public SimpleNode(SQLEngine p, int i) {
15
    this(i);
16
    parser = p;
17
  }
18

    
19
  public void jjtOpen() {
20
  }
21

    
22
  public void jjtClose() {
23
  }
24
  
25
  public void jjtSetParent(Node n) { parent = n; }
26
  public Node jjtGetParent() { return parent; }
27

    
28
  public void jjtAddChild(Node n, int i) {
29
    if (children == null) {
30
      children = new Node[i + 1];
31
    } else if (i >= children.length) {
32
      Node c[] = new Node[i + 1];
33
      System.arraycopy(children, 0, c, 0, children.length);
34
      children = c;
35
    }
36
    children[i] = n;
37
  }
38

    
39
  public Node jjtGetChild(int i) {
40
    return children[i];
41
  }
42

    
43
  public int jjtGetNumChildren() {
44
    return (children == null) ? 0 : children.length;
45
  }
46

    
47
  /** Accept the visitor. **/
48
  public Object jjtAccept(SQLEngineVisitor visitor, Object data) {
49
    return visitor.visit(this, data);
50
  }
51

    
52
  /** Accept the visitor. **/
53
  public Object childrenAccept(SQLEngineVisitor visitor, Object data) {
54
    if (children != null) {
55
      for (int i = 0; i < children.length; ++i) {
56
        children[i].jjtAccept(visitor, data);
57
      }
58
    }
59
    return data;
60
  }
61

    
62
  /* You can override these two methods in subclasses of SimpleNode to
63
     customize the way the node appears when the tree is dumped.  If
64
     your output uses more than one line you should override
65
     toString(String), otherwise overriding toString() is probably all
66
     you need to do. */
67

    
68
  public String toString() { return SQLEngineTreeConstants.jjtNodeName[id]; }
69
  public String toString(String prefix) { return prefix + toString(); }
70

    
71
  /* Override this method if you want to customize how the node dumps
72
     out its children. */
73

    
74
  public void dump(String prefix) {
75
    System.out.println(toString(prefix));
76
    if (children != null) {
77
      for (int i = 0; i < children.length; ++i) {
78
        SimpleNode n = (SimpleNode)children[i];
79
        if (n != null) {
80
          n.dump(prefix + " ");
81
        }
82
      }
83
    }
84
  }
85
}
86