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