Actually I think I see why bubbling exceptions is better than performing boolean checks...so just ignore, unless there is some merit to it...
Cheers, Ole On 12/16/2015 01:08 PM, Ole Ersoy wrote:
Hi, I'm working on making the linear package standalone. The methods that perform precondition checks for matrix operations throw exceptions (See below). An option would be return a boolean instead. Obviously I would love it if CM adopts the code at some point, so I want to check whether changing the interface is going to kill kittens. Cheers, - Ole CURRENT /** * Check if a matrix is multiplication compatible with the instance. * * @param m * Matrix to check. * @throws DimensionMismatchException * if the matrix is not multiplication-compatible with instance. */ protected void checkMultiplicationCompatible(final FieldMatrix<T> m) throws DimensionMismatchException { if (getColumnDimension() != m.getRowDimension()) { throw new DimensionMismatchException(m.getRowDimension(), getColumnDimension()); } } PROPOSED /** * Check if a matrix is multiplication compatible with the instance. * * @param m * Matrix to check. * @return true if the matrix is multiplication compatible, false otherwise. */ protected boolean checkMultiplicationCompatible(final FieldMatrix<T> m) { if (getColumnDimension() != m.getRowDimension()) { return false; } return true; }
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org