You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ce...@apache.org on 2012/01/18 07:38:04 UTC
svn commit: r1232759 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java
Author: celestin
Date: Wed Jan 18 06:38:04 2012
New Revision: 1232759
URL: http://svn.apache.org/viewvc?rev=1232759&view=rev
Log:
In analysis.FunctionUtils.sample, changed the exception to be thrown when bounds are invalid.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java?rev=1232759&r1=1232758&r2=1232759&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java Wed Jan 18 06:38:04 2012
@@ -18,8 +18,8 @@
package org.apache.commons.math.analysis;
import org.apache.commons.math.analysis.function.Identity;
-import org.apache.commons.math.exception.NonMonotonicSequenceException;
import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.apache.commons.math.exception.NumberIsTooLargeException;
import org.apache.commons.math.exception.util.LocalizedFormats;
/**
@@ -309,15 +309,13 @@ public class FunctionUtils {
* @param max the (exclusive) upper bound of the interval
* @param n the number of sample points
* @return the array of samples
- * @throws NonMonotonicSequenceException if the lower bound {@code min} is
+ * @throws NumberIsTooLargeException if the lower bound {@code min} is
* greater than, or equal to the upper bound {@code max}
* @throws NotStrictlyPositiveException if the number of sample points
* {@code n} is negative
*/
public static double[] sample(UnivariateFunction f,
- double min, double max, int n) throws
- NonMonotonicSequenceException,
- NotStrictlyPositiveException {
+ double min, double max, int n) {
if (n <= 0) {
throw new NotStrictlyPositiveException(
@@ -325,10 +323,7 @@ public class FunctionUtils {
Integer.valueOf(n));
}
if (min >= max) {
- throw new NonMonotonicSequenceException(
- Double.valueOf(max),
- Double.valueOf(min),
- 1);
+ throw new NumberIsTooLargeException(min, max, false);
}
double[] s = new double[n];