001    /* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */
002    /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=org.apache.james.mime4j.field.address.BaseNode,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
003    package org.apache.james.mime4j.field.address;
004    
005    public
006    class SimpleNode extends org.apache.james.mime4j.field.address.BaseNode implements Node {
007    
008      protected Node parent;
009      protected Node[] children;
010      protected int id;
011      protected Object value;
012      protected AddressListParser parser;
013    
014      public SimpleNode(int i) {
015        id = i;
016      }
017    
018      public SimpleNode(AddressListParser p, int i) {
019        this(i);
020        parser = p;
021      }
022    
023      public void jjtOpen() {
024      }
025    
026      public void jjtClose() {
027      }
028    
029      public void jjtSetParent(Node n) { parent = n; }
030      public Node jjtGetParent() { return parent; }
031    
032      public void jjtAddChild(Node n, int i) {
033        if (children == null) {
034          children = new Node[i + 1];
035        } else if (i >= children.length) {
036          Node c[] = new Node[i + 1];
037          System.arraycopy(children, 0, c, 0, children.length);
038          children = c;
039        }
040        children[i] = n;
041      }
042    
043      public Node jjtGetChild(int i) {
044        return children[i];
045      }
046    
047      public int jjtGetNumChildren() {
048        return (children == null) ? 0 : children.length;
049      }
050    
051      public void jjtSetValue(Object value) { this.value = value; }
052      public Object jjtGetValue() { return value; }
053    
054      /** Accept the visitor. **/
055      public Object jjtAccept(AddressListParserVisitor visitor, Object data)
056    {
057        return visitor.visit(this, data);
058      }
059    
060      /** Accept the visitor. **/
061      public Object childrenAccept(AddressListParserVisitor visitor, Object data)
062    {
063        if (children != null) {
064          for (int i = 0; i < children.length; ++i) {
065            children[i].jjtAccept(visitor, data);
066          }
067        }
068        return data;
069      }
070    
071      /* You can override these two methods in subclasses of SimpleNode to
072         customize the way the node appears when the tree is dumped.  If
073         your output uses more than one line you should override
074         toString(String), otherwise overriding toString() is probably all
075         you need to do. */
076    
077      public String toString() { return AddressListParserTreeConstants.jjtNodeName[id]; }
078      public String toString(String prefix) { return prefix + toString(); }
079    
080      /* Override this method if you want to customize how the node dumps
081         out its children. */
082    
083      public void dump(String prefix) {
084        System.out.println(toString(prefix));
085        if (children != null) {
086          for (int i = 0; i < children.length; ++i) {
087            SimpleNode n = (SimpleNode)children[i];
088            if (n != null) {
089              n.dump(prefix + " ");
090            }
091          }
092        }
093      }
094    }
095    
096    /* JavaCC - OriginalChecksum=8cc80ffc46cbc025f210b26adc4ead1c (do not edit this line) */