1. /*
  2. * @(#)file SimpleNode.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 4.12
  5. * @(#)date 04/09/15
  6. *
  7. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  8. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  9. *
  10. */
  11. /* Generated By:JJTree: Do not edit this line. SimpleNode.java */
  12. package com.sun.jmx.snmp.IPAcl;
  13. import java.util.Hashtable;
  14. /**
  15. * @version 4.12 12/19/03
  16. * @author Sun Microsystems, Inc.
  17. */
  18. class SimpleNode implements Node {
  19. protected Node parent;
  20. protected Node[] children;
  21. protected int id;
  22. protected Parser parser;
  23. public SimpleNode(int i) {
  24. id = i;
  25. }
  26. public SimpleNode(Parser p, int i) {
  27. this(i);
  28. parser = p;
  29. }
  30. public static Node jjtCreate(int id) {
  31. return new SimpleNode(id);
  32. }
  33. public static Node jjtCreate(Parser p, int id) {
  34. return new SimpleNode(p, id);
  35. }
  36. public void jjtOpen() {
  37. }
  38. public void jjtClose() {
  39. }
  40. public void jjtSetParent(Node n) { parent = n; }
  41. public Node jjtGetParent() { return parent; }
  42. public void jjtAddChild(Node n, int i) {
  43. if (children == null) {
  44. children = new Node[i + 1];
  45. } else if (i >= children.length) {
  46. Node c[] = new Node[i + 1];
  47. System.arraycopy(children, 0, c, 0, children.length);
  48. children = c;
  49. }
  50. children[i] = n;
  51. }
  52. public Node jjtGetChild(int i) {
  53. return children[i];
  54. }
  55. public int jjtGetNumChildren() {
  56. return (children == null) ? 0 : children.length;
  57. }
  58. /*
  59. SR. Extend the SimpleNode definition
  60. */
  61. /**
  62. * Build the Trap entries from the syntactic tree.
  63. */
  64. public void buildTrapEntries(Hashtable dest) {
  65. if (children != null) {
  66. for (int i = 0; i < children.length; ++i) {
  67. SimpleNode n = (SimpleNode)children[i];
  68. if (n != null) {
  69. n.buildTrapEntries(dest);
  70. }
  71. } /* end of loop */
  72. }
  73. }
  74. /**
  75. * Build the Inform entries from the syntactic tree.
  76. */
  77. public void buildInformEntries(Hashtable dest) {
  78. if (children != null) {
  79. for (int i = 0; i < children.length; ++i) {
  80. SimpleNode n = (SimpleNode)children[i];
  81. if (n != null) {
  82. n.buildInformEntries(dest);
  83. }
  84. } /* end of loop */
  85. }
  86. }
  87. /**
  88. * Build the Acl entries from the syntactic tree.
  89. */
  90. public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {
  91. if (children != null) {
  92. for (int i = 0; i < children.length; ++i) {
  93. SimpleNode n = (SimpleNode)children[i];
  94. if (n != null) {
  95. n.buildAclEntries(owner, acl);
  96. }
  97. } /* end of loop */
  98. }
  99. }
  100. /* END SR */
  101. /* You can override these two methods in subclasses of SimpleNode to
  102. customize the way the node appears when the tree is dumped. If
  103. your output uses more than one line you should override
  104. toString(String), otherwise overriding toString() is probably all
  105. you need to do. */
  106. public String toString() { return ParserTreeConstants.jjtNodeName[id]; }
  107. public String toString(String prefix) { return prefix + toString(); }
  108. /* Override this method if you want to customize how the node dumps
  109. out its children. */
  110. public void dump(String prefix) {
  111. if (children != null) {
  112. for (int i = 0; i < children.length; ++i) {
  113. SimpleNode n = (SimpleNode)children[i];
  114. if (n != null) {
  115. n.dump(prefix + " ");
  116. }
  117. }
  118. }
  119. }
  120. }