commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1226359 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform: FastCosineTransformer.java RealTransformer.java
Date Mon, 02 Jan 2012 07:19:58 GMT
Author: celestin
Date: Mon Jan  2 07:19:58 2012
New Revision: 1226359

URL: http://svn.apache.org/viewvc?rev=1226359&view=rev
Log:
Removed references to deprecated MathRuntimeException (MATH-677). 

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1226359&r1=1226358&r2=1226359&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
Mon Jan  2 07:19:58 2012
@@ -16,9 +16,11 @@
  */
 package org.apache.commons.math.transform;
 
-import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateFunction;
 import org.apache.commons.math.complex.Complex;
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.NonMonotonicSequenceException;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
 
@@ -103,8 +105,7 @@ import org.apache.commons.math.util.Fast
  * </p>
  * <p>As of version 2.0 this no longer implements Serializable.</p>
  *
- * @version $Id: FastCosineTransformer.java 1213585 2011-12-13 07:44:52Z
- *          celestin $
+ * @version $Id$
  * @since 1.2
  */
 public class FastCosineTransformer implements RealTransformer {
@@ -154,8 +155,13 @@ public class FastCosineTransformer imple
         return new FastCosineTransformer(true);
     }
 
-    /** {@inheritDoc} */
-    public double[] transform(double[] f) throws IllegalArgumentException {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws MathIllegalArgumentException if the length of the data array is
+     * not a power of two plus one
+     */
+    public double[] transform(double[] f) throws MathIllegalArgumentException {
 
         if (orthogonal) {
             final double s = FastMath.sqrt(2.0 / (f.length - 1));
@@ -164,26 +170,55 @@ public class FastCosineTransformer imple
         return fct(f);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NonMonotonicSequenceException if the lower bound is greater
+     * than, or equal to the upper bound
+     * @throws NotStrictlyPositiveException if the number of sample points is
+     * negative
+     * @throws MathIllegalArgumentException if the number of sample points is
+     * not a power of two plus one
+     */
     public double[] transform(UnivariateFunction f,
-        double min, double max, int n) throws IllegalArgumentException {
+        double min, double max, int n) throws
+        NonMonotonicSequenceException,
+        NotStrictlyPositiveException,
+        MathIllegalArgumentException {
 
         final double[] data = FastFourierTransformer.sample(f, min, max, n);
         return transform(data);
     }
 
-    /** {@inheritDoc} */
-    public double[] inverseTransform(double[] f)
-        throws IllegalArgumentException {
+    /**
+     * {@inheritDoc}
+     *
+     * @throws MathIllegalArgumentException if the length of the data array is
+     * not a power of two plus one
+     */
+    public double[] inverseTransform(double[] f) throws
+        MathIllegalArgumentException {
 
         final double s2 = 2.0 / (f.length - 1);
         final double s1 = orthogonal ? FastMath.sqrt(s2) : s2;
         return FastFourierTransformer.scaleArray(fct(f), s1);
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     *
+     * @throws NonMonotonicSequenceException if the lower bound is greater
+     * than, or equal to the upper bound
+     * @throws NotStrictlyPositiveException if the number of sample points is
+     * negative
+     * @throws MathIllegalArgumentException if the number of sample points is
+     * not a power of two plus one
+     */
     public double[] inverseTransform(UnivariateFunction f,
-        double min, double max, int n) throws IllegalArgumentException {
+        double min, double max, int n) throws
+        NonMonotonicSequenceException,
+        NotStrictlyPositiveException,
+        MathIllegalArgumentException {
 
         final double[] data = FastFourierTransformer.sample(f, min, max, n);
         return inverseTransform(data);
@@ -194,18 +229,19 @@ public class FastCosineTransformer imple
      *
      * @param f the real data array to be transformed
      * @return the real transformed array
-     * @throws IllegalArgumentException if any parameters are invalid
+     * @throws MathIllegalArgumentException if the length of the data array is
+     * not a power of two plus one
      */
     protected double[] fct(double[] f)
-        throws IllegalArgumentException {
+        throws MathIllegalArgumentException {
 
         final double[] transformed = new double[f.length];
 
         final int n = f.length - 1;
         if (!FastFourierTransformer.isPowerOf2(n)) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.NOT_POWER_OF_TWO_PLUS_ONE,
-                    f.length);
+            throw new MathIllegalArgumentException(
+                LocalizedFormats.NOT_POWER_OF_TWO_PLUS_ONE,
+                Integer.valueOf(f.length));
         }
         if (n == 1) {       // trivial case
             transformed[0] = 0.5 * (f[0] + f[1]);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java?rev=1226359&r1=1226358&r2=1226359&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java
Mon Jan  2 07:19:58 2012
@@ -38,10 +38,8 @@ public interface RealTransformer  {
      *
      * @param f the real data array to be transformed (signal)
      * @return the real transformed array (spectrum)
-     * @throws IllegalArgumentException if any parameters are invalid
      */
-    double[] transform(double[] f)
-        throws IllegalArgumentException;
+    double[] transform(double[] f);
 
     /**
      * Returns the forward transform of the specified real function, sampled on
@@ -52,20 +50,16 @@ public interface RealTransformer  {
      * @param max the (exclusive) upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws IllegalArgumentException if any parameters are invalid
      */
-    double[] transform(UnivariateFunction f, double min, double max, int n)
-        throws IllegalArgumentException;
+    double[] transform(UnivariateFunction f, double min, double max, int n);
 
     /**
      * Returns the inverse transform of the specified real data set.
      *
      * @param f the real data array to be inversely transformed
      * @return the real inversely transformed array
-     * @throws IllegalArgumentException if any parameters are invalid
      */
-    double[] inverseTransform(double[] f)
-        throws IllegalArgumentException;
+    double[] inverseTransform(double[] f);
 
     /**
      * Returns the inverse transform of the specified real function, sampled
@@ -76,9 +70,6 @@ public interface RealTransformer  {
      * @param max the (exclusive) upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws IllegalArgumentException if any parameters are invalid
      */
-    double[] inverseTransform(UnivariateFunction f, double min, double max, int n)
-        throws IllegalArgumentException;
-
+    double[] inverseTransform(UnivariateFunction f, double min, double max, int n);
 }



Mime
View raw message