Java Code Examples for org.apache.commons.math.MathException#getPattern()

The following examples show how to use org.apache.commons.math.MathException#getPattern() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractIntegerDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Computes the cumulative probablity function and checks for NaN values returned.
 * Throws MathException if the value is NaN. Wraps and rethrows any MathException encountered
 * evaluating the cumulative probability function in a FunctionEvaluationException. Throws
 * FunctionEvaluationException of the cumulative probability function returns NaN.
 *
 * @param argument input value
 * @return cumulative probability
 * @throws FunctionEvaluationException if a MathException occurs computing the cumulative probability
 */
private double checkedCumulativeProbability(int argument) throws FunctionEvaluationException {
    double result = Double.NaN;
    try {
        result = cumulativeProbability(argument);
    } catch (MathException ex) {
        throw new FunctionEvaluationException(ex, argument, ex.getPattern(), ex.getArguments());
    }
    if (Double.isNaN(result)) {
        throw new FunctionEvaluationException(argument,
            "Discrete cumulative probability function returned NaN for argument {0}", argument);
    }
    return result;
}
 
Example 2
Source File: AbstractIntegerDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Computes the cumulative probablity function and checks for NaN values returned.
 * Throws MathException if the value is NaN. Wraps and rethrows any MathException encountered
 * evaluating the cumulative probability function in a FunctionEvaluationException. Throws
 * FunctionEvaluationException of the cumulative probability function returns NaN.
 *
 * @param argument input value
 * @return cumulative probability
 * @throws FunctionEvaluationException if a MathException occurs computing the cumulative probability
 */
private double checkedCumulativeProbability(int argument) throws FunctionEvaluationException {
    double result = Double.NaN;
    try {
        result = cumulativeProbability(argument);
    } catch (MathException ex) {
        throw new FunctionEvaluationException(ex, argument, ex.getPattern(), ex.getArguments());
    }
    if (Double.isNaN(result)) {
        throw new FunctionEvaluationException(argument,
            "Discrete cumulative probability function returned NaN for argument {0}", argument);
    }
    return result;
}
 
Example 3
Source File: AbstractIntegerDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Computes the cumulative probablity function and checks for NaN values returned.
 * Throws MathException if the value is NaN. Wraps and rethrows any MathException encountered
 * evaluating the cumulative probability function in a FunctionEvaluationException. Throws
 * FunctionEvaluationException of the cumulative probability function returns NaN.
 *
 * @param argument input value
 * @return cumulative probability
 * @throws FunctionEvaluationException if a MathException occurs computing the cumulative probability
 */
private double checkedCumulativeProbability(int argument) throws FunctionEvaluationException {
    double result = Double.NaN;
    try {
        result = cumulativeProbability(argument);
    } catch (MathException ex) {
        throw new FunctionEvaluationException(ex, argument, ex.getPattern(), ex.getArguments());
    }
    if (Double.isNaN(result)) {
        throw new FunctionEvaluationException(argument,
            "Discrete cumulative probability function returned NaN for argument {0}", argument);
    }
    return result;
}
 
Example 4
Source File: AbstractIntegerDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Computes the cumulative probablity function and checks for NaN values returned.
 * Throws MathException if the value is NaN. Wraps and rethrows any MathException encountered
 * evaluating the cumulative probability function in a FunctionEvaluationException. Throws
 * FunctionEvaluationException of the cumulative probability function returns NaN.
 *
 * @param argument input value
 * @return cumulative probability
 * @throws FunctionEvaluationException if a MathException occurs computing the cumulative probability
 */
private double checkedCumulativeProbability(int argument) throws FunctionEvaluationException {
    double result = Double.NaN;
    try {
        result = cumulativeProbability(argument);
    } catch (MathException ex) {
        throw new FunctionEvaluationException(ex, argument, ex.getPattern(), ex.getArguments());
    }
    if (Double.isNaN(result)) {
        throw new FunctionEvaluationException(argument,
            "Discrete cumulative probability function returned NaN for argument {0}", argument);
    }
    return result;
}