KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > util > collections > IntIterator


1 package prefuse.util.collections;
2
3 /**
4  * Abstract LiteralIterator implementation that supports an iteration over
5  * int values. Subclasses need only implement the {@link #nextInt()} method.
6  * The {@link #nextLong()}, {@link #nextFloat()}, and {@link #nextDouble()}
7  * methods all simply cast the output of {@link #nextInt()}. The
8  * {@link #next()} method simply wraps the output of {@link #nextInt()} in
9  * an {@link java.lang.Integer} object.
10  *
11  * @author <a HREF="http://jheer.org">jeffrey heer</a>
12  */

13 public abstract class IntIterator extends AbstractLiteralIterator {
14
15     /**
16      * @see java.util.Iterator#next()
17      */

18     public Object JavaDoc next() {
19         return new Integer JavaDoc(nextInt());
20     }
21
22     /**
23      * @see prefuse.util.collections.LiteralIterator#isDoubleSupported()
24      */

25     public boolean isDoubleSupported() {
26         return true;
27     }
28
29     /**
30      * @see prefuse.util.collections.LiteralIterator#isFloatSupported()
31      */

32     public boolean isFloatSupported() {
33         return true;
34     }
35
36     /**
37      * @see prefuse.util.collections.LiteralIterator#isIntSupported()
38      */

39     public boolean isIntSupported() {
40         return true;
41     }
42
43     /**
44      * @see prefuse.util.collections.LiteralIterator#isLongSupported()
45      */

46     public boolean isLongSupported() {
47         return true;
48     }
49
50     /**
51      * @see prefuse.util.collections.LiteralIterator#nextDouble()
52      */

53     public double nextDouble() {
54         return nextInt();
55     }
56
57     /**
58      * @see prefuse.util.collections.LiteralIterator#nextFloat()
59      */

60     public float nextFloat() {
61         return nextInt();
62     }
63
64     /**
65      * @see prefuse.util.collections.LiteralIterator#nextLong()
66      */

67     public long nextLong() {
68         return nextInt();
69     }
70
71     /**
72      * @see prefuse.util.collections.LiteralIterator#nextInt()
73      */

74     public abstract int nextInt();
75     
76 } // end of abstract class IntIterator
77
Popular Tags