001// 002// Generated by JTB 1.3.2 003// 004 005package jtb.syntaxtree; 006 007import java.util.*; 008 009// Represents a sequence of nodes nested within a choice, list, 010// optional list, or optional, e.g. ( A B )+ or [ C D E ] 011public class NodeSequence implements NodeListInterface { 012 // This was added after running jtb to remove serializable warning. 013 static final long serialVersionUID = 20150406L; 014 015 public NodeSequence(int n) { 016 nodes = new Vector<Node>(n); 017 } 018 019 public NodeSequence(Node firstNode) { 020 nodes = new Vector<Node>(); 021 addNode(firstNode); 022 } 023 024 public void addNode(Node n) { 025 nodes.addElement(n); 026 n.setParent(this); 027 } 028 029 public Node elementAt(int i) { return nodes.elementAt(i); } 030 public Enumeration<Node> elements() { return nodes.elements(); } 031 public int size() { return nodes.size(); } 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