001: /*
002: * Primitive Collections for Java.
003: * Copyright (C) 2002 S�ren Bak
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019: package com.uwyn.rife.pcj.list;
020:
021: import com.uwyn.rife.pcj.IntIterator;
022:
023: /**
024: * This class represents iterators over lists of int values.
025: *
026: * @see java.util.ListIterator
027: *
028: * @author Søren Bak
029: * @version 1.0 2002/29/12
030: * @since 1.0
031: */
032: public interface IntListIterator extends IntIterator {
033:
034: /**
035: * Adds a specified element to the list at this iterator's
036: * current position.
037: *
038: * @param v
039: * the element to add.
040: *
041: * @throws UnsupportedOperationException
042: * if addition is not supported by this
043: * iterator.
044: */
045: void add(int v);
046:
047: /**
048: * Indicates whether more int values can be returned by this
049: * iterator by calling <tt>previous()</tt>.
050: *
051: * @return <tt>true</tt> if more int values can be returned
052: * by this iterator in backwards direction; returns
053: * <tt>false</tt> otherwise.
054: *
055: * @see #previous()
056: */
057: boolean hasPrevious();
058:
059: /**
060: * Returns the index of the element that would be returned by
061: * a call to <tt>next()</tt>.
062: *
063: * @return the index of the element that would be returned by
064: * a call to <tt>next()</tt>.
065: *
066: * @see #next()
067: */
068: int nextIndex();
069:
070: /**
071: * Returns the previous int value of this iterator.
072: *
073: * @return the previous int value of this iterator.
074: *
075: * @throws NoSuchElementException
076: * if no more elements are available from this
077: * iterator in backwards direction.
078: *
079: * @see #hasPrevious()
080: */
081: int previous();
082:
083: /**
084: * Returns the index of the element that would be returned by
085: * a call to <tt>previous()</tt>.
086: *
087: * @return the index of the element that would be returned by
088: * a call to <tt>previous()</tt>; if no more elements
089: * are available in backwards direction, <tt>-1</tt>
090: * is returned.
091: *
092: * @see #previous()
093: */
094: int previousIndex();
095:
096: /**
097: * Sets the last element returned to a specified value.
098: *
099: * @param v
100: * the new value of the element.
101: *
102: * @throws UnsupportedOperationException
103: * if replacement is not supported by this iterator.
104: *
105: * @throws IllegalStateException
106: * if no element has been returned by this iterator
107: * yet.
108: */
109: void set(int v);
110:
111: }
|