commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1379218 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function: Gaussian.java HarmonicOscillator.java Logistic.java Logit.java Sigmoid.java StepFunction.java
Date Thu, 30 Aug 2012 23:18:57 GMT
Author: erans
Date: Thu Aug 30 23:18:57 2012
New Revision: 1379218

URL: http://svn.apache.org/viewvc?rev=1379218&view=rev
Log:
MATH-854
Populate "throws" clause.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logit.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java?rev=1379218&r1=1379217&r2=1379218&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java
Thu Aug 30 23:18:57 2012
@@ -58,7 +58,8 @@ public class Gaussian implements Univari
      */
     public Gaussian(double norm,
                     double mean,
-                    double sigma) {
+                    double sigma)
+        throws NotStrictlyPositiveException {
         if (sigma <= 0) {
             throw new NotStrictlyPositiveException(sigma);
         }
@@ -77,7 +78,8 @@ public class Gaussian implements Univari
      * @throws NotStrictlyPositiveException if {@code sigma <= 0}.
      */
     public Gaussian(double mean,
-                    double sigma) {
+                    double sigma)
+        throws NotStrictlyPositiveException {
         this(1 / (sigma * FastMath.sqrt(2 * Math.PI)), mean, sigma);
     }
 
@@ -122,7 +124,10 @@ public class Gaussian implements Univari
          * not 3.
          * @throws NotStrictlyPositiveException if {@code param[2]} is negative.
          */
-        public double value(double x, double ... param) {
+        public double value(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException,
+                   NotStrictlyPositiveException {
             validateParameters(param);
 
             final double diff = x - param[1];
@@ -144,7 +149,10 @@ public class Gaussian implements Univari
          * not 3.
          * @throws NotStrictlyPositiveException if {@code param[2]} is negative.
          */
-        public double[] gradient(double x, double ... param) {
+        public double[] gradient(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException,
+                   NotStrictlyPositiveException {
             validateParameters(param);
 
             final double norm = param[0];
@@ -170,7 +178,10 @@ public class Gaussian implements Univari
          * not 3.
          * @throws NotStrictlyPositiveException if {@code param[2]} is negative.
          */
-        private void validateParameters(double[] param) {
+        private void validateParameters(double[] param)
+            throws NullArgumentException,
+                   DimensionMismatchException,
+                   NotStrictlyPositiveException {
             if (param == null) {
                 throw new NullArgumentException();
             }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java?rev=1379218&r1=1379217&r2=1379218&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java
Thu Aug 30 23:18:57 2012
@@ -90,7 +90,9 @@ public class HarmonicOscillator implemen
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 3.
          */
-        public double value(double x, double ... param) {
+        public double value(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             validateParameters(param);
             return HarmonicOscillator.value(x * param[1] + param[2], param[0]);
         }
@@ -108,7 +110,9 @@ public class HarmonicOscillator implemen
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 3.
          */
-        public double[] gradient(double x, double ... param) {
+        public double[] gradient(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             validateParameters(param);
 
             final double amplitude = param[0];
@@ -133,7 +137,9 @@ public class HarmonicOscillator implemen
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 3.
          */
-        private void validateParameters(double[] param) {
+        private void validateParameters(double[] param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             if (param == null) {
                 throw new NullArgumentException();
             }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java?rev=1379218&r1=1379217&r2=1379218&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java
Thu Aug 30 23:18:57 2012
@@ -67,7 +67,8 @@ public class Logistic implements Univari
                     double b,
                     double q,
                     double a,
-                    double n) {
+                    double n)
+        throws NotStrictlyPositiveException {
         if (n <= 0) {
             throw new NotStrictlyPositiveException(n);
         }
@@ -113,7 +114,10 @@ public class Logistic implements Univari
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 6.
          */
-        public double value(double x, double ... param) {
+        public double value(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException,
+                   NotStrictlyPositiveException {
             validateParameters(param);
             return Logistic.value(param[1] - x, param[0],
                                   param[2], param[3],
@@ -134,7 +138,10 @@ public class Logistic implements Univari
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 6.
          */
-        public double[] gradient(double x, double ... param) {
+        public double[] gradient(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException,
+                   NotStrictlyPositiveException {
             validateParameters(param);
 
             final double b = param[2];
@@ -165,12 +172,15 @@ public class Logistic implements Univari
          * methods.
          *
          * @param param Values for {@code k}, {@code m}, {@code b}, {@code q},
-         * {@code a} and  {@code n}.
+         * {@code a} and {@code n}.
          * @throws NullArgumentException if {@code param} is {@code null}.
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 6.
          */
-        private void validateParameters(double[] param) {
+        private void validateParameters(double[] param)
+            throws NullArgumentException,
+                   DimensionMismatchException,
+                   NotStrictlyPositiveException {
             if (param == null) {
                 throw new NullArgumentException();
             }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logit.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logit.java?rev=1379218&r1=1379217&r2=1379218&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logit.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Logit.java
Thu Aug 30 23:18:57 2012
@@ -63,7 +63,8 @@ public class Logit implements Univariate
     }
 
     /** {@inheritDoc} */
-    public double value(double x) {
+    public double value(double x)
+        throws OutOfRangeException {
         return value(x, lo, hi);
     }
 
@@ -94,7 +95,9 @@ public class Logit implements Univariate
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 2.
          */
-        public double value(double x, double ... param) {
+        public double value(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             validateParameters(param);
             return Logit.value(x, param[0], param[1]);
         }
@@ -112,7 +115,9 @@ public class Logit implements Univariate
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 2.
          */
-        public double[] gradient(double x, double ... param) {
+        public double[] gradient(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             validateParameters(param);
 
             final double lo = param[0];
@@ -131,7 +136,9 @@ public class Logit implements Univariate
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 2.
          */
-        private void validateParameters(double[] param) {
+        private void validateParameters(double[] param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             if (param == null) {
                 throw new NullArgumentException();
             }
@@ -149,7 +156,8 @@ public class Logit implements Univariate
      */
     private static double value(double x,
                                 double lo,
-                                double hi) {
+                                double hi)
+        throws OutOfRangeException {
         if (x < lo || x > hi) {
             throw new OutOfRangeException(x, lo, hi);
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java?rev=1379218&r1=1379217&r2=1379218&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java
Thu Aug 30 23:18:57 2012
@@ -96,7 +96,9 @@ public class Sigmoid implements Univaria
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 2.
          */
-        public double value(double x, double ... param) {
+        public double value(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             validateParameters(param);
             return Sigmoid.value(x, param[0], param[1]);
         }
@@ -114,7 +116,9 @@ public class Sigmoid implements Univaria
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 2.
          */
-        public double[] gradient(double x, double ... param) {
+        public double[] gradient(double x, double ... param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             validateParameters(param);
 
             final double invExp1 = 1 / (1 + FastMath.exp(-x));
@@ -132,7 +136,9 @@ public class Sigmoid implements Univaria
          * @throws DimensionMismatchException if the size of {@code param} is
          * not 2.
          */
-        private void validateParameters(double[] param) {
+        private void validateParameters(double[] param)
+            throws NullArgumentException,
+                   DimensionMismatchException {
             if (param == null) {
                 throw new NullArgumentException();
             }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java?rev=1379218&r1=1379217&r2=1379218&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
Thu Aug 30 23:18:57 2012
@@ -58,7 +58,10 @@ public class StepFunction implements Uni
      * have the same length.
      */
     public StepFunction(double[] x,
-                        double[] y) {
+                        double[] y)
+        throws NullArgumentException,
+               NoDataException,
+               DimensionMismatchException {
         if (x == null ||
             y == null) {
             throw new NullArgumentException();



Mime
View raw message