001//
002// Generated by JTB 1.3.2
003//
004
005package jtb.syntaxtree;
006
007import java.util.*;
008
009// Represents an optional grammar list, e.g. ( A )*
010public class NodeListOptional implements NodeListInterface {
011   // This was added after running jtb to remove serializable warning.
012   static final long serialVersionUID = 20150406L;
013
014   public NodeListOptional() {
015      nodes = new Vector<Node>();
016   }
017
018   public NodeListOptional(Node firstNode) {
019      nodes = new Vector<Node>();
020      addNode(firstNode);
021   }
022
023   public void addNode(Node n) {
024      nodes.addElement(n);
025      n.setParent(this);
026   }
027
028   public Enumeration<Node> elements() { return nodes.elements(); }
029   public Node elementAt(int i)  { return nodes.elementAt(i); }
030   public int size()             { return nodes.size(); }
031   public boolean present()      { return nodes.size() != 0; }
032   public void accept(jtb.visitor.Visitor v) {
033      v.visit(this);
034   }
035   public <R,A> R accept(jtb.visitor.GJVisitor<R,A> v, A argu) {
036      return v.visit(this,argu);
037   }
038   public <R> R accept(jtb.visitor.GJNoArguVisitor<R> v) {
039      return v.visit(this);
040   }
041   public <A> void accept(jtb.visitor.GJVoidVisitor<A> v, A argu) {
042      v.visit(this,argu);
043   }
044
045   public void setParent(Node n) { parent = n; }
046   public Node getParent()       { return parent; }
047
048   private Node parent;
049   public Vector<Node> nodes;
050}
051