EMMA Coverage Report (generated Wed Jul 26 14:28:59 CDT 2006)
[all classes][com.mysql.jdbc]

COVERAGE SUMMARY FOR SOURCE FILE [RowDataStatic.java]

nameclass, %method, %block, %line, %
RowDataStatic.java100% (1/1)95%  (21/22)95%  (164/172)94%  (38.6/41)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RowDataStatic100% (1/1)95%  (21/22)95%  (164/172)94%  (38.6/41)
getOwner (): ResultSet 0%   (0/1)0%   (0/3)0%   (0/1)
isEmpty (): boolean 100% (1/1)75%  (6/8)75%  (0.8/1)
isFirst (): boolean 100% (1/1)86%  (6/7)86%  (0.9/1)
isLast (): boolean 100% (1/1)89%  (16/18)67%  (2/3)
RowDataStatic (ArrayList): void 100% (1/1)100% (9/9)100% (4/4)
addRow (byte [][]): void 100% (1/1)100% (6/6)100% (2/2)
afterLast (): void 100% (1/1)100% (6/6)100% (2/2)
beforeFirst (): void 100% (1/1)100% (4/4)100% (2/2)
beforeLast (): void 100% (1/1)100% (8/8)100% (2/2)
close (): void 100% (1/1)100% (1/1)100% (1/1)
getAt (int): Object [] 100% (1/1)100% (15/15)100% (3/3)
getCurrentRowNumber (): int 100% (1/1)100% (3/3)100% (1/1)
hasNext (): boolean 100% (1/1)100% (14/14)100% (2/2)
isAfterLast (): boolean 100% (1/1)100% (10/10)100% (1/1)
isBeforeFirst (): boolean 100% (1/1)100% (12/12)100% (1/1)
isDynamic (): boolean 100% (1/1)100% (2/2)100% (1/1)
moveRowRelative (int): void 100% (1/1)100% (7/7)100% (2/2)
next (): Object [] 100% (1/1)100% (21/21)100% (4/4)
removeRow (int): void 100% (1/1)100% (6/6)100% (2/2)
setCurrentRow (int): void 100% (1/1)100% (4/4)100% (2/2)
setOwner (ResultSet): void 100% (1/1)100% (4/4)100% (2/2)
size (): int 100% (1/1)100% (4/4)100% (1/1)

1/*
2 Copyright (C) 2002-2004 MySQL AB
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of version 2 of the GNU General Public License as 
6 published by the Free Software Foundation.
7 
8 There are special exceptions to the terms and conditions of the GPL 
9 as it is applied to this software. View the full text of the 
10 exception in file EXCEPTIONS-CONNECTOR-J in the directory of this 
11 software distribution.
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 
23 
24 */
25package com.mysql.jdbc;
26 
27import java.util.ArrayList;
28import java.util.List;
29 
30/**
31 * Represents an in-memory result set
32 * 
33 * @author dgan
34 * @version $Id: RowDataStatic.java 3726 2005-05-19 15:52:24Z mmatthews $
35 */
36public class RowDataStatic implements RowData {
37        private int index;
38 
39        ResultSet owner;
40 
41        private List rows;
42 
43        /**
44         * Creates a new RowDataStatic object.
45         * 
46         * @param rows
47         *            DOCUMENT ME!
48         */
49        public RowDataStatic(ArrayList rows) {
50                this.index = -1;
51                this.rows = rows;
52        }
53 
54        /**
55         * DOCUMENT ME!
56         * 
57         * @param row
58         *            DOCUMENT ME!
59         */
60        public void addRow(byte[][] row) {
61                this.rows.add(row);
62        }
63 
64        /**
65         * Moves to after last.
66         */
67        public void afterLast() {
68                this.index = this.rows.size();
69        }
70 
71        /**
72         * Moves to before first.
73         */
74        public void beforeFirst() {
75                this.index = -1;
76        }
77 
78        /**
79         * DOCUMENT ME!
80         */
81        public void beforeLast() {
82                this.index = this.rows.size() - 2;
83        }
84 
85        /**
86         * DOCUMENT ME!
87         */
88        public void close() {
89        }
90 
91        /**
92         * DOCUMENT ME!
93         * 
94         * @param atIndex
95         *            DOCUMENT ME!
96         * 
97         * @return DOCUMENT ME!
98         */
99        public Object[] getAt(int atIndex) {
100                if ((atIndex < 0) || (atIndex >= this.rows.size())) {
101                        return null;
102                }
103 
104                return (Object[]) this.rows.get(atIndex);
105        }
106 
107        /**
108         * DOCUMENT ME!
109         * 
110         * @return DOCUMENT ME!
111         */
112        public int getCurrentRowNumber() {
113                return this.index;
114        }
115 
116        /**
117         * @see com.mysql.jdbc.RowData#getOwner()
118         */
119        public ResultSet getOwner() {
120                return this.owner;
121        }
122 
123        /**
124         * DOCUMENT ME!
125         * 
126         * @return DOCUMENT ME!
127         */
128        public boolean hasNext() {
129                boolean hasMore = (this.index + 1) < this.rows.size();
130 
131                return hasMore;
132        }
133 
134        /**
135         * Returns true if we got the last element.
136         * 
137         * @return DOCUMENT ME!
138         */
139        public boolean isAfterLast() {
140                return this.index >= this.rows.size();
141        }
142 
143        /**
144         * Returns if iteration has not occured yet.
145         * 
146         * @return DOCUMENT ME!
147         */
148        public boolean isBeforeFirst() {
149                return (this.index == -1) && (this.rows.size() != 0);
150        }
151 
152        /**
153         * DOCUMENT ME!
154         * 
155         * @return DOCUMENT ME!
156         */
157        public boolean isDynamic() {
158                return false;
159        }
160 
161        /**
162         * DOCUMENT ME!
163         * 
164         * @return DOCUMENT ME!
165         */
166        public boolean isEmpty() {
167                return this.rows.size() == 0;
168        }
169 
170        /**
171         * DOCUMENT ME!
172         * 
173         * @return DOCUMENT ME!
174         */
175        public boolean isFirst() {
176                return this.index == 0;
177        }
178 
179        /**
180         * DOCUMENT ME!
181         * 
182         * @return DOCUMENT ME!
183         */
184        public boolean isLast() {
185                //
186                // You can never be on the 'last' row of
187                // an empty result set
188                //
189                if (this.rows.size() == 0) {
190                        return false;
191                }
192 
193                return (this.index == (this.rows.size() - 1));
194        }
195 
196        /**
197         * DOCUMENT ME!
198         * 
199         * @param rows
200         *            DOCUMENT ME!
201         */
202        public void moveRowRelative(int rowsToMove) {
203                this.index += rowsToMove;
204        }
205 
206        /**
207         * DOCUMENT ME!
208         * 
209         * @return DOCUMENT ME!
210         */
211        public Object[] next() {
212                this.index++;
213 
214                if (this.index < this.rows.size()) {
215                        return (Object[]) this.rows.get(this.index);
216                }
217 
218                return null;
219        }
220 
221        /**
222         * DOCUMENT ME!
223         * 
224         * @param atIndex
225         *            DOCUMENT ME!
226         */
227        public void removeRow(int atIndex) {
228                this.rows.remove(atIndex);
229        }
230 
231        /**
232         * DOCUMENT ME!
233         * 
234         * @param newIndex
235         *            DOCUMENT ME!
236         */
237        public void setCurrentRow(int newIndex) {
238                this.index = newIndex;
239        }
240 
241        /**
242         * @see com.mysql.jdbc.RowData#setOwner(com.mysql.jdbc.ResultSet)
243         */
244        public void setOwner(ResultSet rs) {
245                this.owner = rs;
246        }
247 
248        /**
249         * DOCUMENT ME!
250         * 
251         * @return DOCUMENT ME!
252         */
253        public int size() {
254                return this.rows.size();
255        }
256}

[all classes][com.mysql.jdbc]
EMMA 2.0.4217 (C) Vladimir Roubtsov