/** * Swaps the values between 2 rows. If there is no data in row #<code>pos1</code> then nothing is * stored in row #<ocde>pos2</code>, and vice versia. * * @param pos1 - the row number of first item to be swaped * @param pos2 - the row number of second item to be swaped */ public void swapRows(int pos1, int pos2) { if (pos1 == pos2) { return; } Object obj1 = elements.remove(pos1); Object obj2 = elements.remove(pos2); if (obj1 != null) { setObject(obj1, pos2); } if (obj2 != null) { setObject(obj2, pos1); } missing.swapRows(pos1, pos2); empty.swapRows(pos1, pos2); }
/** * Sets the item at row #<code>pos</code> to be <code>newEntry</code> * * @param newEntry - the object to be assigned to row #<code>pos</code> param pos - the row number * to be set. */ public void setObject(Object newEntry, int pos) { elements.remove(pos); elements.put(pos, newEntry); }
/** * removes a row from this column and returns the removed item as an object * * @param row - the row number to be removed. * @return - the removed object. */ public Object removeRow(int row) { return elements.remove(row); }