/** * Sets the object for a cell in the table. The table is expanded if * necessary. * * @param row the row index (zero-based). * @param column the column index (zero-based). * @param object the object. */ protected void setObject(final int row, final int column, final Object object) { ensureCapacity(row, column); this.data[row][column] = object; this.rows = Math.max(this.rows, row + 1); this.columns = Math.max(this.columns, column + 1); }
if (getRowCount() != ot.getRowCount()) if (getColumnCount() != ot.getColumnCount()) for (int r = 0; r < getRowCount(); r++) for (int c = 0; c < getColumnCount(); c++) if (ObjectUtilities.equal(getObject(r, c), ot.getObject(r, c)) == false)
/** * Copys the contents of the old column to the new column. * * @param oldColumn the index of the old (source) column * @param newColumn the index of the new column */ protected void copyColumn(final int oldColumn, final int newColumn) { for (int i = 0; i < getRowCount(); i++) { setObject(i, newColumn, getObject(i, oldColumn)); } }
/** * Copys the contents of the old row to the new row. This uses raw access to * the data and is remarkably faster than manual copying. * * @param oldRow the index of the old row * @param newRow the index of the new row */ protected void copyRow(final int oldRow, final int newRow) { this.ensureCapacity(newRow, getColumnCount()); final Object[] oldRowStorage = this.data[oldRow]; if (oldRowStorage == null) { final Object[] newRowStorage = this.data[newRow]; if (newRowStorage != null) { Arrays.fill(newRowStorage, null); } } else { this.data[newRow] = (Object[]) oldRowStorage.clone(); } }
/** * Restores a serialized object. * * @param stream the input stream. * @throws java.io.IOException if there is an I/O problem. * @throws ClassNotFoundException if a class cannot be found. */ private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); final int rowCount = stream.readInt(); this.data = new Object[rowCount][]; for (int r = 0; r < rowCount; r++) { final boolean isNotNull = stream.readBoolean(); if (isNotNull) { final int columnCount = stream.readInt(); final Object[] column = new Object[columnCount]; this.data[r] = column; for (int c = 0; c < columnCount; c++) { column[c] = readSerializedData(stream); } } } }
/** * Handles serialization. * * @param stream the output stream. * @throws java.io.IOException if there is an I/O problem. */ private void writeObject(final ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); final int rowCount = this.data.length; stream.writeInt(rowCount); for (int r = 0; r < rowCount; r++) { final Object[] column = this.data[r]; stream.writeBoolean(column != null); if (column != null) { final int columnCount = column.length; stream.writeInt(columnCount); for (int c = 0; c < columnCount; c++) { writeSerializedData(stream, column[c]); } } } }
/** * Copys the contents of the old row to the new row. This uses raw access to * the data and is remarkably faster than manual copying. * * @param oldRow the index of the old row * @param newRow the index of the new row */ protected void copyRow(final int oldRow, final int newRow) { this.ensureCapacity(newRow, getColumnCount()); final Object[] oldRowStorage = this.data[oldRow]; if (oldRowStorage == null) { final Object[] newRowStorage = this.data[newRow]; if (newRowStorage != null) { Arrays.fill(newRowStorage, null); } } else { this.data[newRow] = (Object[]) oldRowStorage.clone(); } }
/** * Restores a serialized object. * * @param stream the input stream. * @throws java.io.IOException if there is an I/O problem. * @throws ClassNotFoundException if a class cannot be found. */ private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); final int rowCount = stream.readInt(); this.data = new Object[rowCount][]; for (int r = 0; r < rowCount; r++) { final boolean isNotNull = stream.readBoolean(); if (isNotNull) { final int columnCount = stream.readInt(); final Object[] column = new Object[columnCount]; this.data[r] = column; for (int c = 0; c < columnCount; c++) { column[c] = readSerializedData(stream); } } } }
/** * Handles serialization. * * @param stream the output stream. * @throws java.io.IOException if there is an I/O problem. */ private void writeObject(final ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); final int rowCount = this.data.length; stream.writeInt(rowCount); for (int r = 0; r < rowCount; r++) { final Object[] column = this.data[r]; stream.writeBoolean(column != null); if (column != null) { final int columnCount = column.length; stream.writeInt(columnCount); for (int c = 0; c < columnCount; c++) { writeSerializedData(stream, column[c]); } } } }
/** * Copys the contents of the old column to the new column. * * @param oldColumn the index of the old (source) column * @param newColumn the index of the new column */ protected void copyColumn(final int oldColumn, final int newColumn) { for (int i = 0; i < getRowCount(); i++) { setObject(i, newColumn, getObject(i, oldColumn)); } }
if (getRowCount() != ot.getRowCount()) if (getColumnCount() != ot.getColumnCount()) for (int r = 0; r < getRowCount(); r++) for (int c = 0; c < getColumnCount(); c++) if (ObjectUtilities.equal(getObject(r, c), ot.getObject(r, c)) == false)
/** * Copys the contents of the old row to the new row. This uses raw access to * the data and is remarkably faster than manual copying. * * @param oldRow the index of the old row * @param newRow the index of the new row */ protected void copyRow(final int oldRow, final int newRow) { this.ensureCapacity(newRow, getColumnCount()); final Object[] oldRowStorage = this.data[oldRow]; if (oldRowStorage == null) { final Object[] newRowStorage = this.data[newRow]; if (newRowStorage != null) { Arrays.fill(newRowStorage, null); } } else { this.data[newRow] = (Object[]) oldRowStorage.clone(); } }
/** * Sets the object for a cell in the table. The table is expanded if * necessary. * * @param row the row index (zero-based). * @param column the column index (zero-based). * @param object the object. */ protected void setObject(final int row, final int column, final Object object) { ensureCapacity(row, column); this.data[row][column] = object; this.rows = Math.max(this.rows, row + 1); this.columns = Math.max(this.columns, column + 1); }
/** * Restores a serialized object. * * @param stream the input stream. * @throws java.io.IOException if there is an I/O problem. * @throws ClassNotFoundException if a class cannot be found. */ private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); final int rowCount = stream.readInt(); this.data = new Object[rowCount][]; for (int r = 0; r < rowCount; r++) { final boolean isNotNull = stream.readBoolean(); if (isNotNull) { final int columnCount = stream.readInt(); final Object[] column = new Object[columnCount]; this.data[r] = column; for (int c = 0; c < columnCount; c++) { column[c] = readSerializedData(stream); } } } }
/** * Handles serialization. * * @param stream the output stream. * @throws java.io.IOException if there is an I/O problem. */ private void writeObject(final ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); final int rowCount = this.data.length; stream.writeInt(rowCount); for (int r = 0; r < rowCount; r++) { final Object[] column = this.data[r]; stream.writeBoolean(column != null); if (column != null) { final int columnCount = column.length; stream.writeInt(columnCount); for (int c = 0; c < columnCount; c++) { writeSerializedData(stream, column[c]); } } } }
/** * Copys the contents of the old column to the new column. * * @param oldColumn the index of the old (source) column * @param newColumn the index of the new column */ protected void copyColumn(final int oldColumn, final int newColumn) { for (int i = 0; i < getRowCount(); i++) { setObject(i, newColumn, getObject(i, oldColumn)); } }
if (getRowCount() != ot.getRowCount()) if (getColumnCount() != ot.getColumnCount()) for (int r = 0; r < getRowCount(); r++) for (int c = 0; c < getColumnCount(); c++) if (ObjectUtilities.equal(getObject(r, c), ot.getObject(r, c)) == false)