01: //
02: // Generated by JTB 1.2.1
03: //
04:
05: package oscript.syntaxtree;
06:
07: import java.util.*;
08:
09: /**
10: * Represents an optional grammar list, e.g. ( A )*
11: */
12: public class NodeListOptional implements NodeListInterface {
13: public NodeListOptional() {
14: nodes = new Vector();
15: }
16:
17: public NodeListOptional(Node firstNode) {
18: nodes = new Vector();
19: addNode(firstNode);
20: }
21:
22: public void addNode(Node n) {
23: nodes.addElement(n);
24: }
25:
26: public Enumeration elements() {
27: return nodes.elements();
28: }
29:
30: public Node elementAt(int i) {
31: return (Node) nodes.elementAt(i);
32: }
33:
34: public int size() {
35: return nodes.size();
36: }
37:
38: public boolean present() {
39: return nodes.size() != 0;
40: }
41:
42: public void accept(oscript.visitor.Visitor v) {
43: v.visit(this );
44: }
45:
46: public Object accept(oscript.visitor.ObjectVisitor v, Object argu) {
47: return v.visit(this , argu);
48: }
49:
50: public Vector nodes;
51: }
|