1 package antlr.collections.impl; 2 3 9 10 import antlr.collections.impl.Vector; 11 import antlr.collections.ASTEnumeration; 12 import antlr.collections.AST; 13 14 import java.util.NoSuchElementException ; 15 16 public class ASTEnumerator implements antlr.collections.ASTEnumeration { 17 18 VectorEnumerator nodes; 19 int i = 0; 20 21 22 public ASTEnumerator(Vector v) { 23 nodes = new VectorEnumerator(v); 24 } 25 26 public boolean hasMoreNodes() { 27 synchronized (nodes) { 28 return i <= nodes.vector.lastElement; 29 } 30 } 31 32 public antlr.collections.AST nextNode() { 33 synchronized (nodes) { 34 if (i <= nodes.vector.lastElement) { 35 return (AST)nodes.vector.data[i++]; 36 } 37 throw new NoSuchElementException ("ASTEnumerator"); 38 } 39 } 40 } 41 | Popular Tags |