diff options
Diffstat (limited to 'src/piglet/syntaxtree/NodeSequence.java')
-rw-r--r-- | src/piglet/syntaxtree/NodeSequence.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/piglet/syntaxtree/NodeSequence.java b/src/piglet/syntaxtree/NodeSequence.java new file mode 100644 index 0000000..b935394 --- /dev/null +++ b/src/piglet/syntaxtree/NodeSequence.java @@ -0,0 +1,46 @@ +// +// Generated by JTB 1.3.2 +//
+
+package piglet.syntaxtree; + +import java.util.Enumeration; +import java.util.Vector; + +/** + * Represents a sequence of nodes nested within a choice, list, + * optional list, or optional, e.g. ( A B )+ or [ C D E ] + */ +public class NodeSequence implements NodeListInterface { + public NodeSequence(int n) { + nodes = new Vector<Node>(n); + } + + public NodeSequence(Node firstNode) { + nodes = new Vector<Node>(); + addNode(firstNode); + } + + public void addNode(Node n) { + nodes.addElement(n); + } + + public Node elementAt(int i) { return nodes.elementAt(i); } + public Enumeration<Node> elements() { return nodes.elements(); } + public int size() { return nodes.size(); } + public void accept(piglet.visitor.Visitor v) { + v.visit(this); + } + public <R,A> R accept(piglet.visitor.GJVisitor<R,A> v, A argu) { + return v.visit(this,argu); + } + public <R> R accept(piglet.visitor.GJNoArguVisitor<R> v) { + return v.visit(this); + } + public <A> void accept(piglet.visitor.GJVoidVisitor<A> v, A argu) { + v.visit(this,argu); + } + + public Vector<Node> nodes; +} +
|