KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbunit > dataset > DefaultDataSet


1 /*
2  *
3  * The DbUnit Database Testing Framework
4  * Copyright (C)2002-2004, DbUnit.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */

21
22 package org.dbunit.dataset;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.List JavaDoc;
26
27
28 /**
29  * @author Manuel Laflamme
30  * @version $Revision: 1.12 $
31  * @since Feb 18, 2002
32  */

33 public class DefaultDataSet extends AbstractDataSet
34 {
35     private final List JavaDoc _tableList = new ArrayList JavaDoc();
36
37     public DefaultDataSet()
38     {
39     }
40
41     public DefaultDataSet(ITable table)
42     {
43         addTable(table);
44     }
45
46     public DefaultDataSet(ITable[] tables)
47     {
48         for (int i = 0; i < tables.length; i++)
49         {
50             addTable(tables[i]);
51         }
52     }
53
54     public DefaultDataSet(ITable table1, ITable table2)
55     {
56         addTable(table1);
57         addTable(table2);
58     }
59
60     /**
61      * Add a new table in this dataset.
62      */

63     public void addTable(ITable table)
64     {
65         _tableList.add(table);
66     }
67
68     ////////////////////////////////////////////////////////////////////////////
69
// AbstractDataSet class
70

71     protected ITableIterator createIterator(boolean reversed)
72             throws DataSetException
73     {
74         ITable[] tables = (ITable[])_tableList.toArray(new ITable[0]);
75         return new DefaultTableIterator(tables, reversed);
76     }
77 }
78
79
80
81
82
83
84
Popular Tags