1 2 29 package com.puppycrawl.tools.checkstyle.checks.usage.transmogrify; 30 31 import java.util.Iterator ; 32 import java.util.NoSuchElementException ; 33 34 41 public class SymTabASTIterator implements Iterator { 42 private SymTabAST _current; 43 44 49 public SymTabASTIterator(SymTabAST parent) { 50 _current = (SymTabAST)parent.getFirstChild(); 51 } 52 53 60 public boolean hasNext() { 61 return (_current != null); 62 } 63 64 69 public Object next() { 70 if (!hasNext()) { 71 throw new NoSuchElementException (); 72 } 73 74 Object result = _current; 75 _current = (SymTabAST)_current.getNextSibling(); 76 77 return result; 78 } 79 80 85 public SymTabAST nextChild() { 86 return (SymTabAST)next(); 87 } 88 89 92 public void remove() { 93 throw new UnsupportedOperationException (); 94 } 95 } 96 | Popular Tags |