1 package prefuse.data.util; 2 3 import java.util.ConcurrentModificationException ; 4 import java.util.Date ; 5 6 import prefuse.data.Table; 7 import prefuse.util.collections.IntIterator; 8 9 15 public class TableIterator extends IntIterator { 16 17 private Table m_table; 18 private IntIterator m_rows; 19 private int m_modCount; 20 21 protected int m_cur = -1; 22 23 28 public TableIterator(Table table, IntIterator rows) { 29 m_table = table; 30 m_rows = rows; 31 m_modCount = table.getModificationCount(); 32 } 33 34 37 41 public int nextInt() { 42 if ( m_modCount != m_table.getModificationCount() ) 43 throw new ConcurrentModificationException (); 44 m_cur = m_rows.nextInt(); 45 return m_cur; 46 } 47 48 51 public boolean hasNext() { 52 return m_rows.hasNext(); 53 } 54 55 59 public void remove() { 60 if ( m_table.removeRow(m_cur) ) 61 modify(); 62 } 63 64 67 protected void modify() { 68 ++m_modCount; 69 m_cur = -1; 70 } 71 72 75 86 public final boolean canGet(String field, Class type) { 87 return m_table.canGet(field, type); 88 } 89 90 101 public final boolean canSet(String field, Class type) { 102 return m_table.canSet(field, type); 103 } 104 105 113 public final Object get(String field) { 114 return m_table.get(m_cur, field); 115 } 116 117 127 public final void set(String field, Object val) { 128 ++m_modCount; 129 m_table.set(m_cur, field, val); 130 } 131 132 135 143 public final boolean canGetInt(String field) { 144 return m_table.canGetInt(field); 145 } 146 147 154 public final boolean canSetInt(String field) { 155 return m_table.canSetInt(field); 156 } 157 158 163 public final int getInt(String field) { 164 return m_table.getInt(m_cur, field); 165 } 166 167 173 public final void setInt(String field, int val) { 174 ++m_modCount; 175 m_table.setInt(m_cur, field, val); 176 } 177 178 180 188 public final boolean canGetLong(String field) { 189 return m_table.canGetLong(field); 190 } 191 192 199 public final boolean canSetLong(String field) { 200 return m_table.canSetLong(field); 201 } 202 203 208 public final long getLong(String field) { 209 return m_table.getLong(m_cur, field); 210 } 211 212 218 public final void setLong(String field, long val) { 219 ++m_modCount; 220 m_table.setLong(m_cur, field, val); 221 } 222 223 225 233 public final boolean canGetFloat(String field) { 234 return m_table.canGetFloat(field); 235 } 236 237 244 public final boolean canSetFloat(String field) { 245 return m_table.canSetFloat(field); 246 } 247 248 253 public final float getFloat(String field) { 254 return m_table.getFloat(m_cur, field); 255 } 256 257 263 public final void setFloat(String field, float val) { 264 ++m_modCount; 265 m_table.setFloat(m_cur, field, val); 266 } 267 268 270 278 public final boolean canGetDouble(String field) { 279 return m_table.canGetDouble(field); 280 } 281 282 289 public final boolean canSetDouble(String field) { 290 return m_table.canSetDouble(field); 291 } 292 293 298 public final double getDouble(String field) { 299 return m_table.getDouble(m_cur, field); 300 } 301 302 308 public final void setDouble(String field, double val) { 309 ++m_modCount; 310 m_table.setDouble(m_cur, field, val); 311 } 312 313 315 323 public final boolean canGetBoolean(String field) { 324 return m_table.canGetBoolean(field); 325 } 326 327 334 public final boolean canSetBoolean(String field) { 335 return m_table.canSetBoolean(field); 336 } 337 338 343 public final boolean getBoolean(String field) { 344 return m_table.getBoolean(m_cur, field); 345 } 346 347 353 public final void setBoolean(String field, boolean val) { 354 ++m_modCount; 355 m_table.setBoolean(m_cur, field, val); 356 } 357 358 360 368 public final boolean canGetString(String field) { 369 return m_table.canGetString(field); 370 } 371 372 379 public final boolean canSetString(String field) { 380 return m_table.canSetString(field); 381 } 382 383 388 public final String getString(String field) { 389 return m_table.getString(m_cur, field); 390 } 391 392 398 public final void setString(String field, String val) { 399 ++m_modCount; 400 m_table.setString(m_cur, field, val); 401 } 402 403 405 413 public final boolean canGetDate(String field) { 414 return m_table.canGetDate(field); 415 } 416 417 424 public final boolean canSetDate(String field) { 425 return m_table.canSetDate(field); 426 } 427 428 433 public final Date getDate(String field) { 434 return m_table.getDate(m_cur, field); 435 } 436 437 443 public final void setDate(String field, Date val) { 444 ++m_modCount; 445 m_table.setDate(m_cur, field, val); 446 } 447 448 } | Popular Tags |