/** * Release a row and mark it as free. * * @param row the row index of the released row * @return true if the row was successfully released, false if it was already free or if the input * is not a valid row index */ public boolean releaseRow(int row) { if (row < 0) { return false; } else if (m_openRows != null && m_openRows.containsKey(row)) { return false; } else if (row == m_curId) { --m_curId; } else if (row == m_firstId) { ++m_firstId; } else { if (m_openRows == null) m_openRows = new IntIntTreeMap(false); m_openRows.put(row, row); } return true; }
/** * Indicates if a given row value is a valid, occupied row of the table. * * @param row the row index to check * @return true if the row is valid and in use by the Table, false if it is an illegal value or is * currently free */ public boolean isValidRow(int row) { return (row >= m_firstId && row <= m_curId && (m_openRows == null || !m_openRows.containsKey(row))); }