• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  */
18 /* Generated By:JJTree: Do not edit this line. SimpleNode.java */
19 /* JJT: 0.3pre1 */
20 
21 package Mini;
22 
23 /**
24  *
25  * @version $Id$
26  */
27 public abstract class SimpleNode implements Node {
28   protected Node parent;
29   protected Node[] children;
30   protected int id;
31   protected MiniParser parser;
32 
SimpleNode(int i)33   public SimpleNode(int i) {
34     id = i;
35   }
36 
SimpleNode(MiniParser p, int i)37   public SimpleNode(MiniParser p, int i) {
38     this(i);
39     parser = p;
40   }
41 
jjtOpen()42   public void jjtOpen() {
43   }
44 
jjtClose()45   public void jjtClose() {
46   }
47 
closeNode()48   public void closeNode() {
49   }
50 
jjtSetParent(Node n)51   public void jjtSetParent(Node n) { parent = n; }
jjtGetParent()52   public Node jjtGetParent() { return parent; }
53 
jjtAddChild(Node n, int i)54   public void jjtAddChild(Node n, int i) {
55     if (children == null) {
56       children = new Node[i + 1];
57     } else if (i >= children.length) {
58       Node c[] = new Node[i + 1];
59       System.arraycopy(children, 0, c, 0, children.length);
60       children = c;
61     }
62     children[i] = n;
63   }
64 
jjtGetChild(int i)65   public Node jjtGetChild(int i) {
66     return children[i];
67   }
68 
jjtGetNumChildren()69   public int jjtGetNumChildren() {
70     return (children == null) ? 0 : children.length;
71   }
72 
73   /* You can override these two methods in subclasses of SimpleNode to
74      customize the way the node appears when the tree is dumped.  If
75      your output uses more than one line you should override
76      toString(String), otherwise overriding toString() is probably all
77      you need to do. */
78 
79   @Override
toString()80   public String toString() { return MiniParserTreeConstants.jjtNodeName[id]; }
toString(String prefix)81   public String toString(String prefix) { return prefix + toString(); }
82 
83   /* Override this method if you want to customize how the node dumps
84      out its children. */
85 
dump(String prefix)86   public void dump(String prefix) {
87     System.out.println(toString(prefix));
88     if (children != null) {
89       for (int i = 0; i < children.length; ++i) {
90         SimpleNode n = (SimpleNode)children[i];
91         if (n != null) {
92           n.dump(prefix + " ");
93         }
94       }
95     }
96   }
97 }
98 
99