/** * Returns an unmodifiable view of the given matrix. The returned matrix is immutable * only if the given {@code matrix} is not modified anymore after this method call. * * @param matrix the matrix for which to get an unmodifiable view, or {@code null}. * @return a unmodifiable view of the given matrix, or {@code null} if the given matrix was null. * * @since 0.6 */ public static MatrixSIS unmodifiable(final Matrix matrix) { if (matrix == null || matrix instanceof UnmodifiableMatrix) { return (MatrixSIS) matrix; } else { return new UnmodifiableMatrix(matrix); } }
/** * Returns an unmodifiable view of the given matrix. The returned matrix is immutable * only if the given {@code matrix} is not modified anymore after this method call. * * @param matrix the matrix for which to get an unmodifiable view, or {@code null}. * @return a unmodifiable view of the given matrix, or {@code null} if the given matrix was null. * * @since 0.6 */ public static MatrixSIS unmodifiable(final Matrix matrix) { if (matrix == null || matrix instanceof UnmodifiableMatrix) { return (MatrixSIS) matrix; } else { return new UnmodifiableMatrix(matrix); } }