1 package antlr.collections.impl; 2 3 9 10 import antlr.collections.List; 11 import antlr.collections.Stack; 12 13 import java.util.Enumeration ; 14 import java.util.NoSuchElementException ; 15 16 import antlr.collections.impl.LLCell; 17 18 22 final class LLEnumeration implements Enumeration { 23 LLCell cursor; 24 LList list; 25 26 27 28 public LLEnumeration(LList l) { 29 list = l; 30 cursor = list.head; 31 } 32 33 36 public boolean hasMoreElements() { 37 if (cursor != null) 38 return true; 39 else 40 return false; 41 } 42 43 48 public Object nextElement() { 49 if (!hasMoreElements()) throw new NoSuchElementException (); 50 LLCell p = cursor; 51 cursor = cursor.next; 52 return p.data; 53 } 54 } 55 | Popular Tags |