001// 002// Generated by JTB 1.3.2 003// 004 005package jtb.syntaxtree; 006 007import java.util.*; 008 009// Represents a grammar list, e.g. ( A )+ 010public class NodeList implements NodeListInterface { 011 // This was added after running jtb to remove serializable warning. 012 static final long serialVersionUID = 20150406L; 013 014 public NodeList() { 015 nodes = new Vector<Node>(); 016 } 017 018 public NodeList(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 void accept(jtb.visitor.Visitor v) { 032 v.visit(this); 033 } 034 public <R,A> R accept(jtb.visitor.GJVisitor<R,A> v, A argu) { 035 return v.visit(this,argu); 036 } 037 public <R> R accept(jtb.visitor.GJNoArguVisitor<R> v) { 038 return v.visit(this); 039 } 040 public <A> void accept(jtb.visitor.GJVoidVisitor<A> v, A argu) { 041 v.visit(this,argu); 042 } 043 044 public void setParent(Node n) { parent = n; } 045 public Node getParent() { return parent; } 046 047 private Node parent; 048 public Vector<Node> nodes; 049} 050