src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/XMLAttributesIteratorImpl.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.org.apache.xerces.internal.util; |
26 package com.sun.org.apache.xerces.internal.util; |
27 |
27 |
28 //java imports |
28 import java.util.Iterator; |
29 import java.util.Iterator ; |
|
30 import java.util.NoSuchElementException; |
29 import java.util.NoSuchElementException; |
31 |
|
32 //xerces imports |
|
33 import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl ; |
|
34 |
30 |
35 /** |
31 /** |
36 * |
32 * |
37 * @author Neeraj Bajaj, Sun Microsystems |
33 * @author Neeraj Bajaj, Sun Microsystems |
38 */ |
34 */ |
45 * |
41 * |
46 * Should we change XMLAttributes interface to implement Iteraotr ? I think its better avoid touching XNI as |
42 * Should we change XMLAttributes interface to implement Iteraotr ? I think its better avoid touching XNI as |
47 * much as possible. - NB. |
43 * much as possible. - NB. |
48 */ |
44 */ |
49 |
45 |
50 public class XMLAttributesIteratorImpl extends XMLAttributesImpl implements Iterator { |
46 public class XMLAttributesIteratorImpl extends XMLAttributesImpl implements |
|
47 Iterator<XMLAttributesImpl.Attribute> { |
51 |
48 |
52 //pointer to current position. |
49 //pointer to current position. |
53 protected int fCurrent = 0 ; |
50 protected int fCurrent = 0 ; |
54 |
51 |
55 protected XMLAttributesImpl.Attribute fLastReturnedItem ; |
52 protected XMLAttributesImpl.Attribute fLastReturnedItem ; |
60 |
57 |
61 public boolean hasNext() { |
58 public boolean hasNext() { |
62 return fCurrent < getLength() ? true : false ; |
59 return fCurrent < getLength() ? true : false ; |
63 }//hasNext() |
60 }//hasNext() |
64 |
61 |
65 public Object next() { |
62 public XMLAttributesImpl.Attribute next() { |
66 if(hasNext()){ |
63 if(hasNext()){ |
67 // should this be of type javax.xml.stream.Attribute ? |
64 // should this be of type javax.xml.stream.Attribute ? |
68 return fLastReturnedItem = fAttributes[fCurrent++] ; |
65 return fLastReturnedItem = fAttributes[fCurrent++] ; |
69 } |
66 } |
70 else{ |
67 else{ |