simplenode.java

来自「JAVA的一些源码 JAVA2 STANDARD EDITION DEVELO」· Java 代码 · 共 145 行

JAVA
145
字号
/* * @(#)file      SimpleNode.java * @(#)author    Sun Microsystems, Inc. * @(#)version   4.12 * @(#)date      07/09/25 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * *//* Generated By:JJTree: Do not edit this line. SimpleNode.java */package com.sun.jmx.snmp.IPAcl;import java.util.Hashtable;/**  * @version     4.12     12/19/03  * @author      Sun Microsystems, Inc.  */ class SimpleNode implements Node {    protected Node parent;    protected Node[] children;    protected int id;    protected Parser parser;    public SimpleNode(int i) {        id = i;    }    public SimpleNode(Parser p, int i) {        this(i);        parser = p;    }    public static Node jjtCreate(int id) {        return new SimpleNode(id);    }    public static Node jjtCreate(Parser p, int id) {        return new SimpleNode(p, id);    }    public void jjtOpen() {    }    public void jjtClose() {    }      public void jjtSetParent(Node n) { parent = n; }    public Node jjtGetParent() { return parent; }    public void jjtAddChild(Node n, int i) {        if (children == null) {            children = new Node[i + 1];        } else if (i >= children.length) {            Node c[] = new Node[i + 1];            System.arraycopy(children, 0, c, 0, children.length);            children = c;        }        children[i] = n;    }    public Node jjtGetChild(int i) {        return children[i];    }    public int jjtGetNumChildren() {        return (children == null) ? 0 : children.length;    }    /*      SR. Extend the SimpleNode definition    */    /**     * Build the Trap entries from the syntactic tree.     */    public void buildTrapEntries(Hashtable dest) {        if (children != null) {            for (int i = 0; i < children.length; ++i) {                SimpleNode n = (SimpleNode)children[i];                if (n != null) {                    n.buildTrapEntries(dest);                }            } /* end of loop */        }                         }    /**     * Build the Inform entries from the syntactic tree.     */    public void buildInformEntries(Hashtable dest) {        if (children != null) {            for (int i = 0; i < children.length; ++i) {                SimpleNode n = (SimpleNode)children[i];                if (n != null) {                    n.buildInformEntries(dest);                }            } /* end of loop */        }                         }    /**     * Build the Acl entries from the syntactic tree.     */    public void buildAclEntries(PrincipalImpl owner, AclImpl acl) {        if (children != null) {            for (int i = 0; i < children.length; ++i) {                SimpleNode n = (SimpleNode)children[i];                if (n != null) {                    n.buildAclEntries(owner, acl);                }            } /* end of loop */        }                         }    /* END SR */    /* You can override these two methods in subclasses of SimpleNode to       customize the way the node appears when the tree is dumped.  If       your output uses more than one line you should override       toString(String), otherwise overriding toString() is probably all       you need to do. */    public String toString() { return ParserTreeConstants.jjtNodeName[id]; }    public String toString(String prefix) { return prefix + toString(); }    /* Override this method if you want to customize how the node dumps       out its children. */    public void dump(String prefix) {        if (children != null) {            for (int i = 0; i < children.length; ++i) {                SimpleNode n = (SimpleNode)children[i];                if (n != null) {                    n.dump(prefix + " ");                }            }        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?