/** * Sets all cells to the state specified by <tt>values</tt>. * <tt>values</tt> is required to have the form <tt>values[row][column]</tt> * and have exactly the same number of rows and columns as the receiver. * <p> * The values are copied. So subsequent changes in <tt>values</tt> are not reflected in the matrix, and vice-versa. * * @param values the values to be filled into the cells. * @return <tt>this</tt> (for convenience only). * @throws IllegalArgumentException if <tt>values.length != rows() || for any 0 <= row < rows(): values[row].length != columns()</tt>. */ public ObjectMatrix2D assign(Object[][] values) { if (this.isNoView) { if (values.length != rows) throw new IllegalArgumentException("Must have same number of rows: rows="+values.length+"rows()="+rows()); int i = columns*(rows-1); for (int row=rows; --row >= 0;) { Object[] currentRow = values[row]; if (currentRow.length != columns) throw new IllegalArgumentException("Must have same number of columns in every row: columns="+currentRow.length+"columns()="+columns()); System.arraycopy(currentRow, 0, this.elements, i, columns); i -= columns; } } else { super.assign(values); } return this; } /**
/** * Sets all cells to the state specified by <tt>values</tt>. * <tt>values</tt> is required to have the form <tt>values[row][column]</tt> * and have exactly the same number of rows and columns as the receiver. * <p> * The values are copied. So subsequent changes in <tt>values</tt> are not reflected in the matrix, and vice-versa. * * @param values the values to be filled into the cells. * @return <tt>this</tt> (for convenience only). * @throws IllegalArgumentException if <tt>values.length != rows() || for any 0 <= row < rows(): values[row].length != columns()</tt>. */ public ObjectMatrix2D assign(Object[][] values) { if (this.isNoView) { if (values.length != rows) throw new IllegalArgumentException("Must have same number of rows: rows="+values.length+"rows()="+rows()); int i = columns*(rows-1); for (int row=rows; --row >= 0;) { Object[] currentRow = values[row]; if (currentRow.length != columns) throw new IllegalArgumentException("Must have same number of columns in every row: columns="+currentRow.length+"columns()="+columns()); System.arraycopy(currentRow, 0, this.elements, i, columns); i -= columns; } } else { super.assign(values); } return this; } /**