001// 002// Generated by JTB 1.1.2 003// 004 005package jtb.cparser.syntaxtree; 006 007import java.util.*; 008 009/** 010 * Represents an optional grammar list, e.g. ( A )* 011 */ 012public class NodeListOptional implements NodeListInterface { 013 static final long serialVersionUID = 20050923L; 014 015 public NodeListOptional() { 016 nodes = new Vector<Node>(); 017 } 018 019 public NodeListOptional(Node firstNode) { 020 nodes = new Vector<Node>(); 021 addNode(firstNode); 022 } 023 024 public void addNode(Node n) { 025 nodes.addElement(n); 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.cparser.visitor.Visitor v) { 033 v.visit(this); 034 } 035 036 public Vector<Node> nodes; 037}