View Javadoc
1   /*
2    * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  
27  /* Generated By:JJTree: Do not edit this line. SimpleNode.java */
28  
29  package com.sun.jmx.snmp.IPAcl;
30  
31  import java.net.InetAddress;
32  import java.util.Hashtable;
33  import java.util.Vector;
34  
35  class SimpleNode implements Node {
36      protected Node parent;
37      protected Node[] children;
38      protected int id;
39      protected Parser parser;
40  
41      public SimpleNode(int i) {
42          id = i;
43      }
44  
45      public SimpleNode(Parser p, int i) {
46          this(i);
47          parser = p;
48      }
49  
50      public static Node jjtCreate(int id) {
51          return new SimpleNode(id);
52      }
53  
54      public static Node jjtCreate(Parser p, int id) {
55          return new SimpleNode(p, id);
56      }
57  
58      public void jjtOpen() {
59      }
60  
61      public void jjtClose() {
62      }
63  
64      public void jjtSetParent(Node n) { parent = n; }
65      public Node jjtGetParent() { return parent; }
66  
67      public void jjtAddChild(Node n, int i) {
68          if (children == null) {
69              children = new Node[i + 1];
70          } else if (i >= children.length) {
71              Node c[] = new Node[i + 1];
72              System.arraycopy(children, 0, c, 0, children.length);
73              children = c;
74          }
75          children[i] = n;
76      }
77  
78      public Node jjtGetChild(int i) {
79          return children[i];
80      }
81  
82      public int jjtGetNumChildren() {
83          return (children == null) ? 0 : children.length;
84      }
85  
86      /*
87        SR. Extend the SimpleNode definition
88      */
89  
90      /**
91       * Build the Trap entries from the syntactic tree.
92       */
93      public void buildTrapEntries(Hashtable<InetAddress, Vector<String>> dest) {
94          if (children != null) {
95              for (int i = 0; i < children.length; ++i) {
96                  SimpleNode n = (SimpleNode)children[i];
97                  if (n != null) {
98                      n.buildTrapEntries(dest);
99                  }
100             } /* end of loop */
101         }
102     }
103     /**
104      * Build the Inform entries from the syntactic tree.
105      */
106     public void buildInformEntries(Hashtable<InetAddress, Vector<String>> dest) {
107         if (children != null) {
108             for (int i = 0; i < children.length; ++i) {
109                 SimpleNode n = (SimpleNode)children[i];
110                 if (n != null) {
111                     n.buildInformEntries(dest);
112                 }
113             } /* end of loop */
114         }
115     }
116 
117     /**
118      * Build the Acl entries from the syntactic tree.
119      */
120     public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {
121         if (children != null) {
122             for (int i = 0; i < children.length; ++i) {
123                 SimpleNode n = (SimpleNode)children[i];
124                 if (n != null) {
125                     n.buildAclEntries(owner, acl);
126                 }
127             } /* end of loop */
128         }
129     }
130 
131     /* END SR */
132 
133     /* You can override these two methods in subclasses of SimpleNode to
134        customize the way the node appears when the tree is dumped.  If
135        your output uses more than one line you should override
136        toString(String), otherwise overriding toString() is probably all
137        you need to do. */
138 
139     public String toString() { return ParserTreeConstants.jjtNodeName[id]; }
140     public String toString(String prefix) { return prefix + toString(); }
141 
142     /* Override this method if you want to customize how the node dumps
143        out its children. */
144 
145     public void dump(String prefix) {
146         if (children != null) {
147             for (int i = 0; i < children.length; ++i) {
148                 SimpleNode n = (SimpleNode)children[i];
149                 if (n != null) {
150                     n.dump(prefix + " ");
151                 }
152             }
153         }
154     }
155 }