1 19 package com.mysql.jdbc; 20 21 import java.util.ArrayList ; 22 import java.util.List ; 23 24 25 31 public class RowDataStatic implements RowData { 32 private List rows; 33 private int index; 34 private ResultSet owner; 35 36 41 public RowDataStatic(ArrayList rows) { 42 this.index = -1; 43 this.rows = rows; 44 } 45 46 50 public boolean isAfterLast() { 51 return this.index >= rows.size(); 52 } 53 54 61 public byte[][] getAt(int atIndex) { 62 if ((atIndex < 0) || (atIndex >= rows.size())) { 63 return null; 64 } else { 65 return (byte[][]) rows.get(atIndex); 66 } 67 } 68 69 73 public boolean isBeforeFirst() { 74 return (this.index == -1) && (this.rows.size() != 0); 75 } 76 77 82 public void setCurrentRow(int newIndex) { 83 this.index = newIndex; 84 } 85 86 89 public void setOwner(ResultSet rs) { 90 this.owner = rs; 91 } 92 93 96 public ResultSet getOwner() { 97 return this.owner; 98 } 99 100 105 public int getCurrentRowNumber() { 106 return this.index; 107 } 108 109 114 public boolean isDynamic() { 115 return false; 116 } 117 118 123 public boolean isEmpty() { 124 return rows.size() == 0; 125 } 126 127 132 public boolean isFirst() { 133 return this.index == 0; 134 } 135 136 141 public boolean isLast() { 142 if (rows.size() == 0) { 147 return false; 148 } 149 150 return (this.index == (rows.size() - 1)); 151 } 152 153 158 public void addRow(byte[][] row) { 159 rows.add(row); 160 } 161 162 165 public void afterLast() { 166 this.index = rows.size(); 167 } 168 169 172 public void beforeFirst() { 173 this.index = -1; 174 } 175 176 179 public void beforeLast() { 180 this.index = rows.size() - 2; 181 } 182 183 186 public void close() { 187 } 188 189 194 public boolean hasNext() { 195 boolean hasMore = (this.index + 1) < rows.size(); 196 197 return hasMore; 198 } 199 200 205 public void moveRowRelative(int rows) { 206 this.index += rows; 207 } 208 209 214 public byte[][] next() { 215 this.index++; 216 217 if (this.index < rows.size()) { 218 return (byte[][]) rows.get(this.index); 219 } else { 220 return null; 221 } 222 } 223 224 229 public void removeRow(int atIndex) { 230 rows.remove(atIndex); 231 } 232 233 238 public int size() { 239 return rows.size(); 240 } 241 } 242 | Popular Tags |