1 package antlr.collections.impl;
2
3 import antlr.collections.impl.Vector;
4 import antlr.collections.ASTEnumeration;
5 import antlr.collections.AST;
6 import java.util.NoSuchElementException;
7
8 public class ASTEnumerator implements ASTEnumerationons.ASTEnumeration {
9
10 VectorEnumerator nodes;
11 int i = 0;
12
13
14 public ASTEnumerator(Vector v) {
15 nodes = new VectorEnumerator(v);
16 }
17 public boolean hasMoreNodes() {
18 synchronized (nodes) {
19 return i <= nodes.vector.lastElement;
20 }
21 }
22 public ASTlr.collections.AST nextNode() {
23 synchronized (nodes) {
24 if (i <= nodes.vector.lastElement) {
25 return (AST)nodes.vector.data[i++];
26 }
27 throw new NoSuchElementException("ASTEnumerator");
28 }
29 }
30 }
31