1 20 21 27 28 package com.sun.org.apache.xerces.internal.util; 29 30 import java.util.Iterator ; 32 import java.util.NoSuchElementException ; 33 34 import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl ; 36 37 41 42 51 52 public class XMLAttributesIteratorImpl extends XMLAttributesImpl implements Iterator { 53 54 protected int fCurrent = 0 ; 56 57 protected XMLAttributesImpl.Attribute fLastReturnedItem ; 58 59 60 public XMLAttributesIteratorImpl() { 61 } 62 63 public boolean hasNext() { 64 return fCurrent < getLength() ? true : false ; 65 } 67 public Object next() { 68 if(hasNext()){ 69 return fLastReturnedItem = fAttributes[fCurrent++] ; 71 } 72 else{ 73 throw new NoSuchElementException () ; 74 } 75 } 77 public void remove() { 78 if(fLastReturnedItem == fAttributes[fCurrent - 1]){ 80 removeAttributeAt(fCurrent--) ; 82 } 83 else { 84 throw new IllegalStateException (); 87 } 88 } 90 public void removeAllAttributes() { 91 super.removeAllAttributes() ; 92 fCurrent = 0 ; 93 } 94 98 103 104 } | Popular Tags |