KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > snmp > IPAcl > SimpleNode


1 /*
2  * @(#)file SimpleNode.java
3  * @(#)author Sun Microsystems, Inc.
4  * @(#)version 4.12
5  * @(#)date 08/02/09
6  *
7  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
8  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
9  *
10  */

11
12
13 /* Generated By:JJTree: Do not edit this line. SimpleNode.java */
14
15 package com.sun.jmx.snmp.IPAcl;
16
17 import java.util.Hashtable JavaDoc;
18
19 /**
20  * @version 4.12 12/19/03
21  * @author Sun Microsystems, Inc.
22  */

23 class SimpleNode implements Node {
24     protected Node parent;
25     protected Node[] children;
26     protected int id;
27     protected Parser parser;
28
29     public SimpleNode(int i) {
30         id = i;
31     }
32
33     public SimpleNode(Parser p, int i) {
34         this(i);
35         parser = p;
36     }
37
38     public static Node jjtCreate(int id) {
39         return new SimpleNode(id);
40     }
41
42     public static Node jjtCreate(Parser p, int id) {
43         return new SimpleNode(p, id);
44     }
45
46     public void jjtOpen() {
47     }
48
49     public void jjtClose() {
50     }
51   
52     public void jjtSetParent(Node n) { parent = n; }
53     public Node jjtGetParent() { return parent; }
54
55     public void jjtAddChild(Node n, int i) {
56         if (children == null) {
57             children = new Node[i + 1];
58         } else if (i >= children.length) {
59             Node c[] = new Node[i + 1];
60             System.arraycopy(children, 0, c, 0, children.length);
61             children = c;
62         }
63         children[i] = n;
64     }
65
66     public Node jjtGetChild(int i) {
67         return children[i];
68     }
69
70     public int jjtGetNumChildren() {
71         return (children == null) ? 0 : children.length;
72     }
73
74     /*
75       SR. Extend the SimpleNode definition
76     */

77
78     /**
79      * Build the Trap entries from the syntactic tree.
80      */

81     public void buildTrapEntries(Hashtable JavaDoc dest) {
82         if (children != null) {
83             for (int i = 0; i < children.length; ++i) {
84                 SimpleNode n = (SimpleNode)children[i];
85                 if (n != null) {
86                     n.buildTrapEntries(dest);
87                 }
88             } /* end of loop */
89         }
90     }
91     /**
92      * Build the Inform entries from the syntactic tree.
93      */

94     public void buildInformEntries(Hashtable JavaDoc dest) {
95         if (children != null) {
96             for (int i = 0; i < children.length; ++i) {
97                 SimpleNode n = (SimpleNode)children[i];
98                 if (n != null) {
99                     n.buildInformEntries(dest);
100                 }
101             } /* end of loop */
102         }
103     }
104
105     /**
106      * Build the Acl entries from the syntactic tree.
107      */

108     public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {
109         if (children != null) {
110             for (int i = 0; i < children.length; ++i) {
111                 SimpleNode n = (SimpleNode)children[i];
112                 if (n != null) {
113                     n.buildAclEntries(owner, acl);
114                 }
115             } /* end of loop */
116         }
117     }
118
119     /* END SR */
120
121     /* You can override these two methods in subclasses of SimpleNode to
122        customize the way the node appears when the tree is dumped. If
123        your output uses more than one line you should override
124        toString(String), otherwise overriding toString() is probably all
125        you need to do. */

126
127     public String JavaDoc toString() { return ParserTreeConstants.jjtNodeName[id]; }
128     public String JavaDoc toString(String JavaDoc prefix) { return prefix + toString(); }
129
130     /* Override this method if you want to customize how the node dumps
131        out its children. */

132
133     public void dump(String JavaDoc prefix) {
134         if (children != null) {
135             for (int i = 0; i < children.length; ++i) {
136                 SimpleNode n = (SimpleNode)children[i];
137                 if (n != null) {
138                     n.dump(prefix + " ");
139                 }
140             }
141         }
142     }
143 }
144
145
Popular Tags