FileDocCategorySizeDatePackage
JJTAddressListParserState.javaAPI DocAndroid 1.5 API3215Wed May 06 22:42:46 BST 2009org.apache.james.mime4j.field.address.parser

JJTAddressListParserState

public class JJTAddressListParserState extends Object

Fields Summary
private Stack
nodes
private Stack
marks
private int
sp
private int
mk
private boolean
node_created
Constructors Summary
JJTAddressListParserState()

    nodes = new java.util.Stack();
    marks = new java.util.Stack();
    sp = 0;
    mk = 0;
  
Methods Summary
voidclearNodeScope(Node n)

    while (sp > mk) {
      popNode();
    }
    mk = ((Integer)marks.pop()).intValue();
  
voidcloseNodeScope(Node n, int num)

    mk = ((Integer)marks.pop()).intValue();
    while (num-- > 0) {
      Node c = popNode();
      c.jjtSetParent(n);
      n.jjtAddChild(c, num);
    }
    n.jjtClose();
    pushNode(n);
    node_created = true;
  
voidcloseNodeScope(Node n, boolean condition)

    if (condition) {
      int a = nodeArity();
      mk = ((Integer)marks.pop()).intValue();
      while (a-- > 0) {
	Node c = popNode();
	c.jjtSetParent(n);
	n.jjtAddChild(c, a);
      }
      n.jjtClose();
      pushNode(n);
      node_created = true;
    } else {
      mk = ((Integer)marks.pop()).intValue();
      node_created = false;
    }
  
intnodeArity()

    return sp - mk;
  
booleannodeCreated()

    return node_created;
  
voidopenNodeScope(Node n)

    marks.push(new Integer(mk));
    mk = sp;
    n.jjtOpen();
  
NodepeekNode()

    return (Node)nodes.peek();
  
NodepopNode()

    if (--sp < mk) {
      mk = ((Integer)marks.pop()).intValue();
    }
    return (Node)nodes.pop();
  
voidpushNode(Node n)

    nodes.push(n);
    ++sp;
  
voidreset()

    nodes.removeAllElements();
    marks.removeAllElements();
    sp = 0;
    mk = 0;
  
NoderootNode()

    return (Node)nodes.elementAt(0);