Source code: javatools/db/DbRowSetIterator.java
1 /*
2 * DbRowSetIterator.java
3 *
4 * Created on 31 marzo 2003, 18.43
5 Javatools (modified version) - Some useful general classes.
6 Copyright (C) 2002-2003 Chris Bitmead (original) Antonio Petrelli (modified)
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 Contact me at: brenmcguire@users.sourceforge.net
23 */
24
25 package javatools.db;
26
27 import java.util.*;
28
29 /**
30 *
31 * @author antonio
32 */
33 public class DbRowSetIterator implements javatools.db.DbIterator {
34
35 /** Creates a new instance of DbRowSetIterator */
36 public DbRowSetIterator(DbRowSet rs) {
37 this.rowIt = rs.listIterator();
38 }
39
40 public boolean hasNext() {
41 return rowIt.hasNext();
42 }
43
44 public Object next() {
45 return rowIt.next();
46 }
47
48 public void remove() {
49 rowIt.remove();
50 }
51
52 /** Are there more rows to iterator through?
53 * @throws DbException If something goes wrong.
54 * @return <CODE>true</CODE>: there are still more rows;
55 * <CODE>false</CODE>: no there are not.
56 */
57 public boolean hasNextRow() throws DbException {
58 return hasNext();
59 }
60
61 /** Get the next DbRow in the table.
62 * @throws DbException If something goes wrong.
63 * @return The next row.
64 */
65 public DbRow nextRow() throws DbException {
66 return (DbRow) next();
67 }
68
69 private Iterator rowIt;
70 }