Example usage for org.apache.commons.math MathRuntimeException createIllegalArgumentException

List of usage examples for org.apache.commons.math MathRuntimeException createIllegalArgumentException

Introduction

In this page you can find the example usage for org.apache.commons.math MathRuntimeException createIllegalArgumentException.

Prototype

public static IllegalArgumentException createIllegalArgumentException(final Throwable rootCause) 

Source Link

Document

Constructs a new IllegalArgumentException with specified nested Throwable root cause.

Usage

From source file:uk.ac.leeds.ccg.andyt.projects.fluvialglacial.PolynomialFunctionNewtonForm.java

/**
 * Verifies that the input arrays are valid. 
 * <p> //from ww  w.j  a v a  2 s  .c  om
 * The centers must be distinct for interpolation purposes, but not 
 * for general use. Thus it is not verified here.</p> 
 * 
 * @param a the coefficients in Newton form formula 
 * @param c the centers 
 * @throws IllegalArgumentException if not valid 
 * @see org.apache.commons.math.analysis.interpolation.DividedDifferenceInterpolator#computeDividedDifference(double[], 
 * double[]) 
 */
protected static void verifyInputArray(double a[], double c[]) throws IllegalArgumentException {

    if (a.length < 1 || c.length < 1) {
        throw MathRuntimeException
                .createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
    }
    if (a.length != c.length + 1) {
        throw MathRuntimeException.createIllegalArgumentException(
                LocalizedFormats.ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1, a.length, c.length);
    }
}