commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r991164 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization: ./ general/ univariate/
Date Tue, 31 Aug 2010 12:05:01 GMT
Author: erans
Date: Tue Aug 31 12:05:00 2010
New Revision: 991164

URL: http://svn.apache.org/viewvc?rev=991164&view=rev
Log:
Added checks for "null".

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java?rev=991164&r1=991163&r2=991164&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java
Tue Aug 31 12:05:00 2010
@@ -50,6 +50,7 @@ public interface BaseMultivariateRealOpt
      * @throws DimensionMismatchException if the start point dimension is wrong.
      * @throws TooManyEvaluationsException if the maximal number of evaluations is
      * exceeded.
+     * @throws NullArgumentException if any argument is {@code null}.
      */
     RealPointValuePair optimize(FUNC f, GoalType goalType, double[] startPoint)
         throws FunctionEvaluationException;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java?rev=991164&r1=991163&r2=991164&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java
Tue Aug 31 12:05:00 2010
@@ -52,6 +52,7 @@ public interface BaseMultivariateVectori
      * @throws DimensionMismatchException if the start point dimension is wrong.
      * @throws TooManyEvaluationsException if the maximal number of evaluations is
      * exceeded.
+     * @throws NullArgumentException if any argument is {@code null}.
      */
     VectorialPointValuePair optimize(FUNC f, double[] target, double[] weight,
                                      double[] startPoint)

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java?rev=991164&r1=991163&r2=991164&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java
Tue Aug 31 12:05:00 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.util.Incrementor;
 import org.apache.commons.math.exception.MaxCountExceededException;
 import org.apache.commons.math.exception.TooManyEvaluationsException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.optimization.BaseMultivariateRealOptimizer;
 import org.apache.commons.math.optimization.GoalType;
@@ -124,6 +125,17 @@ public abstract class BaseAbstractScalar
                                        GoalType goalType,
                                        double[] startPoint)
         throws FunctionEvaluationException {
+        // Checks.
+        if (f == null) {
+            throw new NullArgumentException();
+        }
+        if (goalType == null) {
+            throw new NullArgumentException();
+        }
+        if (startPoint == null) {
+            throw new NullArgumentException();
+        }
+
         // Reset.
         evaluations.resetCount();
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java?rev=991164&r1=991163&r2=991164&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java
Tue Aug 31 12:05:00 2010
@@ -22,6 +22,7 @@ import org.apache.commons.math.util.Incr
 import org.apache.commons.math.exception.MaxCountExceededException;
 import org.apache.commons.math.exception.TooManyEvaluationsException;
 import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;
 import org.apache.commons.math.optimization.BaseMultivariateVectorialOptimizer;
 import org.apache.commons.math.optimization.GoalType;
@@ -122,7 +123,19 @@ public abstract class BaseAbstractVector
                                             double[] target, double[] weight,
                                             double[] startPoint)
         throws FunctionEvaluationException {
-
+        // Checks.
+        if (f == null) {
+            throw new NullArgumentException();
+        }
+        if (target == null) {
+            throw new NullArgumentException();
+        }
+        if (weight == null) {
+            throw new NullArgumentException();
+        }
+        if (startPoint == null) {
+            throw new NullArgumentException();
+        }
         if (target.length != weight.length) {
             throw new DimensionMismatchException(target.length, weight.length);
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java?rev=991164&r1=991163&r2=991164&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
Tue Aug 31 12:05:00 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.util.Incrementor;
 import org.apache.commons.math.exception.MaxCountExceededException;
 import org.apache.commons.math.exception.TooManyEvaluationsException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.ConvergenceChecker;
@@ -115,6 +116,14 @@ public abstract class AbstractUnivariate
                                                  double min, double max,
                                                  double startValue)
         throws FunctionEvaluationException {
+        // Checks.
+        if (f == null) {
+            throw new NullArgumentException();
+        }
+        if (goalType == null) {
+            throw new NullArgumentException();
+        }
+
         // Reset.
         searchMin = min;
         searchMax = max;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java?rev=991164&r1=991163&r2=991164&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java
Tue Aug 31 12:05:00 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.optimiza
 
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.optimization.BaseOptimizer;
 import org.apache.commons.math.optimization.GoalType;
 
@@ -80,6 +81,7 @@ public interface BaseUnivariateRealOptim
      * function.
      * @throws IllegalArgumentException if {@code min > max} or the endpoints
      * do not satisfy the requirements specified by the optimizer.
+     * @throws NullArgumentException if any argument is {@code null}.
      */
     UnivariateRealPointValuePair optimize(FUNC f, GoalType goalType,
                                           double min, double max,



Mime
View raw message