/** * Sets all cells to the state specified by <tt>values</tt>. * <tt>values</tt> is required to have the form <tt>values[slice][row][column]</tt> * and have exactly the same number of slices, 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 != slices() || for any 0 <= slice < slices(): values[slice].length != rows()</tt>. * @throws IllegalArgumentException if <tt>for any 0 <= column < columns(): values[slice][row].length != columns()</tt>. */ public ObjectMatrix3D assign(Object[][][] values) { if (values.length != slices) throw new IllegalArgumentException("Must have same number of slices: slices="+values.length+"slices()="+slices()); for (int slice=slices; --slice >= 0;) { Object[][] currentSlice = values[slice]; if (currentSlice.length != rows) throw new IllegalArgumentException("Must have same number of rows in every slice: rows="+currentSlice.length+"rows()="+rows()); for (int row=rows; --row >= 0;) { Object[] currentRow = currentSlice[row]; if (currentRow.length != columns) throw new IllegalArgumentException("Must have same number of columns in every row: columns="+currentRow.length+"columns()="+columns()); for (int column=columns; --column >= 0;) { setQuick(slice,row,column,currentRow[column]); } } } return this; } /**
/** * Sets all cells to the state specified by <tt>values</tt>. * <tt>values</tt> is required to have the form <tt>values[slice][row][column]</tt> * and have exactly the same number of slices, 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 != slices() || for any 0 <= slice < slices(): values[slice].length != rows()</tt>. * @throws IllegalArgumentException if <tt>for any 0 <= column < columns(): values[slice][row].length != columns()</tt>. */ public ObjectMatrix3D assign(Object[][][] values) { if (values.length != slices) throw new IllegalArgumentException("Must have same number of slices: slices="+values.length+"slices()="+slices()); for (int slice=slices; --slice >= 0;) { Object[][] currentSlice = values[slice]; if (currentSlice.length != rows) throw new IllegalArgumentException("Must have same number of rows in every slice: rows="+currentSlice.length+"rows()="+rows()); for (int row=rows; --row >= 0;) { Object[] currentRow = currentSlice[row]; if (currentRow.length != columns) throw new IllegalArgumentException("Must have same number of columns in every row: columns="+currentRow.length+"columns()="+columns()); for (int column=columns; --column >= 0;) { setQuick(slice,row,column,currentRow[column]); } } } return this; } /**
if (column < 0 || column >= matrix.columns()) throw new IndexOutOfBoundsException("column="+column+", matrix="+Formatter.shape(matrix));
if (column < 0 || column >= matrix.columns()) throw new IndexOutOfBoundsException("column="+column+", matrix="+Formatter.shape(matrix));
ObjectMatrix3D other = (ObjectMatrix3D) otherObj; if (rows!=other.rows()) return false; if (columns!=other.columns()) return false;
ObjectMatrix3D other = (ObjectMatrix3D) otherObj; if (rows!=other.rows()) return false; if (columns!=other.columns()) return false;