01: /**
02: * com.mckoi.util.IntegerIterator 02 Jul 2000
03: *
04: * Mckoi SQL Database ( http://www.mckoi.com/database )
05: * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * Version 2 as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License Version 2 for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * Version 2 along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: * Change Log:
21: *
22: *
23: */package com.mckoi.util;
24:
25: /**
26: * An iterator for a list of integer's.
27: *
28: * @author Tobias Downer
29: */
30:
31: public interface IntegerIterator {
32:
33: /**
34: * Returns <tt>true</tt> if this list iterator has more elements when
35: * traversing the list in the forward direction. (In other words, returns
36: * <tt>true</tt> if <tt>next</tt> would return an element rather than
37: * throwing an exception.)
38: */
39: boolean hasNext();
40:
41: /**
42: * Returns the next element in the list. This method may be called
43: * repeatedly to iterate through the list, or intermixed with calls to
44: * <tt>previous</tt> to go back and forth. (Note that alternating calls
45: * to <tt>next</tt> and <tt>previous</tt> will return the same element
46: * repeatedly.)
47: */
48: int next();
49:
50: /**
51: * Returns <tt>true</tt> if this list iterator has more elements when
52: * traversing the list in the reverse direction. (In other words, returns
53: * <tt>true</tt> if <tt>previous</tt> would return an element rather than
54: * throwing an exception.)
55: */
56: boolean hasPrevious();
57:
58: /**
59: * Returns the previous element in the list. This method may be called
60: * repeatedly to iterate through the list backwards, or intermixed with
61: * calls to <tt>next</tt> to go back and forth. (Note that alternating
62: * calls to <tt>next</tt> and <tt>previous</tt> will return the same
63: * element repeatedly.)
64: */
65: int previous();
66:
67: /**
68: * Removes from the list the last element returned by the iterator.
69: * This method can be called only once per call to <tt>next</tt>. The
70: * behavior of an iterator is unspecified if the underlying collection is
71: * modified while the iteration is in progress in any way other than by
72: * calling this method.
73: * <p>
74: * Some implementations of IntegerIterator may choose to not implement this
75: * method, in which case an appropriate exception is generated.
76: */
77: void remove();
78:
79: }
|