KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > bak > pcj > list > IntListIterator


1 /*
2  * Primitive Collections for Java.
3  * Copyright (C) 2002 Søren Bak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package bak.pcj.list;
20
21 import bak.pcj.IntIterator;
22 import java.util.NoSuchElementException JavaDoc;
23
24 /**
25  * This class represents iterators over lists of int values.
26  *
27  * @see java.util.ListIterator
28  *
29  * @author Søren Bak
30  * @version 1.0 2002/29/12
31  * @since 1.0
32  */

33 public interface IntListIterator extends IntIterator {
34
35     /**
36      * Adds a specified element to the list at this iterator's
37      * current position.
38      *
39      * @param v
40      * the element to add.
41      *
42      * @throws UnsupportedOperationException
43      * if addition is not supported by this
44      * iterator.
45      */

46     void add(int v);
47
48     /**
49      * Indicates whether more int values can be returned by this
50      * iterator by calling <tt>previous()</tt>.
51      *
52      * @return <tt>true</tt> if more int values can be returned
53      * by this iterator in backwards direction; returns
54      * <tt>false</tt> otherwise.
55      *
56      * @see #previous()
57      */

58     boolean hasPrevious();
59
60     /**
61      * Returns the index of the element that would be returned by
62      * a call to <tt>next()</tt>.
63      *
64      * @return the index of the element that would be returned by
65      * a call to <tt>next()</tt>.
66      *
67      * @see #next()
68      */

69     int nextIndex();
70
71     /**
72      * Returns the previous int value of this iterator.
73      *
74      * @return the previous int value of this iterator.
75      *
76      * @throws NoSuchElementException
77      * if no more elements are available from this
78      * iterator in backwards direction.
79      *
80      * @see #hasPrevious()
81      */

82     int previous();
83
84     /**
85      * Returns the index of the element that would be returned by
86      * a call to <tt>previous()</tt>.
87      *
88      * @return the index of the element that would be returned by
89      * a call to <tt>previous()</tt>; if no more elements
90      * are available in backwards direction, <tt>-1</tt>
91      * is returned.
92      *
93      * @see #previous()
94      */

95     int previousIndex();
96
97     /**
98      * Sets the last element returned to a specified value.
99      *
100      * @param v
101      * the new value of the element.
102      *
103      * @throws UnsupportedOperationException
104      * if replacement is not supported by this iterator.
105      *
106      * @throws IllegalStateException
107      * if no element has been returned by this iterator
108      * yet.
109      */

110     void set(int v);
111
112 }
Popular Tags