1 11 12 13 14 15 package com.sun.jmx.snmp.IPAcl; 16 17 import java.util.Hashtable ; 18 19 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 77 78 81 public void buildTrapEntries(Hashtable 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 } 89 } 90 } 91 94 public void buildInformEntries(Hashtable 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 } 102 } 103 } 104 105 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 } 116 } 117 } 118 119 120 121 126 127 public String toString() { return ParserTreeConstants.jjtNodeName[id]; } 128 public String toString(String prefix) { return prefix + toString(); } 129 130 132 133 public void dump(String 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 |