Author: erans
Date: Fri Jul  9 13:15:28 2010
New Revision: 962515

URL: http://svn.apache.org/viewvc?rev=962515&view=rev
Log:
MATH-361

Modified:
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotPositiveException.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotStrictlyPositiveException.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
    
commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java
 Fri Jul  9 13:15:28 2010
@@ -19,7 +19,7 @@ package org.apache.commons.math.analysis
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.util.LocalizedFormats;
@@ -58,12 +58,13 @@ public class PolynomialFunction implemen
      *
      * @param c polynomial coefficients
      * @throws NullPointerException if c is null
-     * @throws IllegalArgumentException if c is empty
+     * @throws NotStrictlyPositiveException if c is empty
      */
     public PolynomialFunction(double c[]) {
         super();
         if (c.length < 1) {
-            throw 
MathRuntimeException.createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
+            throw new 
NotStrictlyPositiveException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY,
+                                                   c.length);
         }
         int l = c.length;
         while ((l > 1) && (c[l - 1] == 0)) {
@@ -117,13 +118,14 @@ public class PolynomialFunction implemen
      * @param coefficients  the coefficients of the polynomial to evaluate
      * @param argument  the input value
      * @return  the value of the polynomial
-     * @throws IllegalArgumentException if coefficients is empty
+     * @throws NotStrictlyPositiveException if coefficients is empty
      * @throws NullPointerException if coefficients is null
      */
     protected static double evaluate(double[] coefficients, double argument) {
         int n = coefficients.length;
         if (n < 1) {
-            throw 
MathRuntimeException.createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
+            throw new 
NotStrictlyPositiveException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY,
+                                                   n);
         }
         double result = coefficients[n - 1];
         for (int j = n -2; j >=0; j--) {
@@ -226,13 +228,14 @@ public class PolynomialFunction implemen
      *
      * @param coefficients  the coefficients of the polynomial to differentiate
      * @return the coefficients of the derivative or null if coefficients has 
length 1.
-     * @throws IllegalArgumentException if coefficients is empty
+     * @throws NotStrictlyPositiveException if coefficients is empty
      * @throws NullPointerException if coefficients is null
      */
     protected static double[] differentiate(double[] coefficients) {
         int n = coefficients.length;
         if (n < 1) {
-            throw 
MathRuntimeException.createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
+            throw new 
NotStrictlyPositiveException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY,
+                                                   n);
         }
         if (n == 1) {
             return new double[]{0};

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotPositiveException.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotPositiveException.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotPositiveException.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotPositiveException.java
 Fri Jul  9 13:15:28 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.exception;
 
-import org.apache.commons.math.util.LocalizedFormats;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * Exception to be thrown when the argument is negative.
@@ -33,4 +33,14 @@ public class NotPositiveException extend
     public NotPositiveException(Number value) {
         super(value, 0, true);
     }
+    /**
+     * Construct the exception with a specific context.
+     *
+     * @param specific Specific context where the error occurred.
+     * @param value Argument.
+     */
+    public NotPositiveException(Localizable specific,
+                                Number value) {
+        super(specific, value, 0, true);
+    }
 }

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotStrictlyPositiveException.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotStrictlyPositiveException.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotStrictlyPositiveException.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NotStrictlyPositiveException.java
 Fri Jul  9 13:15:28 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.exception;
 
-import org.apache.commons.math.util.LocalizedFormats;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * Exception to be thrown when the argument is negative.
@@ -33,4 +33,14 @@ public class NotStrictlyPositiveExceptio
     public NotStrictlyPositiveException(Number value) {
         super(value, 0, false);
     }
+    /**
+     * Construct the exception with a specific context.
+     *
+     * @param specific Specific context where the error occurred.
+     * @param value Argument.
+     */
+    public NotStrictlyPositiveException(Localizable specific,
+                                        Number value) {
+        super(specific, value, 0, false);
+    }
 }

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java
 Fri Jul  9 13:15:28 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.math.exception;
 
+import org.apache.commons.math.util.Localizable;
 import org.apache.commons.math.util.LocalizedFormats;
 
 /**
@@ -43,7 +44,21 @@ public class NumberIsTooLargeException e
     public NumberIsTooLargeException(Number wrong,
                                      Number max,
                                      boolean boundIsAllowed) {
-        super((boundIsAllowed ?
+        this(null, wrong, max, boundIsAllowed);
+    }
+    /**
+     * Construct the exception with a specific context.
+     *
+     * @param specific Specific contexte pattern .
+     * @param wrong Value that is larger than the maximum.
+     * @param max maximum.
+     */
+    public NumberIsTooLargeException(Localizable specific,
+                                     Number wrong,
+                                     Number max,
+                                     boolean boundIsAllowed) {
+        super(specific,
+              (boundIsAllowed ?
                LocalizedFormats.NUMBER_TOO_LARGE :
                LocalizedFormats.NUMBER_TOO_LARGE_BOUND_EXCLUDED),
               wrong, max);

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/AbstractRandomGenerator.java
 Fri Jul  9 13:15:28 2010
@@ -16,15 +16,14 @@
  */
 package org.apache.commons.math.random;
 
-import org.apache.commons.math.MathRuntimeException;
-import org.apache.commons.math.util.LocalizedFormats;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
 
 /**
  * Abstract class implementing the {...@link  RandomGenerator} interface.
  * Default implementations for all methods other than {...@link #nextDouble()} 
and
  * {...@link #setSeed(long)} are provided.
  * <p>
- * All data generation methods are based on <code>nextDouble().</code>
+ * All data generation methods are based on {...@code code nextDouble()}.
  * Concrete implementations <strong>must</strong> override
  * this method and <strong>should</strong> provide better / more
  * performant implementations of the other methods if the underlying PRNG
@@ -39,7 +38,7 @@ public abstract class AbstractRandomGene
      * Cached random normal value.  The default implementation for
      * {...@link #nextGaussian} generates pairs of values and this field 
caches the
      * second value so that the full algorithm is not executed for every
-     * activation.  The value <code>Double.NaN</code> signals that there is
+     * activation.  The value {...@code Double.NaN} signals that there is
      * no cached value.  Use {...@link #clear} to clear the cached value.
      */
     private double cachedNormalDeviate = Double.NaN;
@@ -55,7 +54,7 @@ public abstract class AbstractRandomGene
     /**
      * Clears the cache used by the default implementation of
      * {...@link #nextGaussian}. Implemementations that do not override the
-     * default implementation of <code>nextGaussian</code> should call this
+     * default implementation of {...@code nextGaussian} should call this
      * method in the implementation of {...@link #setSeed(long)}
      */
     public void clear() {
@@ -81,11 +80,11 @@ public abstract class AbstractRandomGene
 
     /**
      * Sets the seed of the underyling random number generator using a
-     * <code>long</code> seed.  Sequences of values generated starting with the
+     * {...@code long} seed.  Sequences of values generated starting with the
      * same seeds should be identical.
      * <p>
      * Implementations that do not override the default implementation of
-     * <code>nextGaussian</code> should include a call to {...@link #clear} in 
the
+     * {...@code nextGaussian} should include a call to {...@link #clear} in 
the
      * implementation of this method.</p>
      *
      * @param seed the seed value
@@ -120,9 +119,9 @@ public abstract class AbstractRandomGene
     }
 
      /**
-     * Returns the next pseudorandom, uniformly distributed <code>int</code>
+     * Returns the next pseudorandom, uniformly distributed {...@code int}
      * value from this random number generator's sequence.
-     * All 2<font size="-1"><sup>32</sup></font> possible <tt>int</tt> values
+     * All 2<font size="-1"><sup>32</sup></font> possible {...@code int} values
      * should be produced with  (approximately) equal probability.
      * <p>
      * The default implementation provided here returns
@@ -130,7 +129,7 @@ public abstract class AbstractRandomGene
      * <code>(int) (nextDouble() * Integer.MAX_VALUE)</code>
      * </pre></p>
      *
-     * @return the next pseudorandom, uniformly distributed <code>int</code>
+     * @return the next pseudorandom, uniformly distributed {...@code int}
      *  value from this random number generator's sequence
      */
     public int nextInt() {
@@ -138,7 +137,7 @@ public abstract class AbstractRandomGene
     }
 
     /**
-     * Returns a pseudorandom, uniformly distributed <tt>int</tt> value
+     * Returns a pseudorandom, uniformly distributed {...@code int} value
      * between 0 (inclusive) and the specified value (exclusive), drawn from
      * this random number generator's sequence.
      * <p>
@@ -149,23 +148,22 @@ public abstract class AbstractRandomGene
      *
      * @param n the bound on the random number to be returned.  Must be
      * positive.
-     * @return  a pseudorandom, uniformly distributed <tt>int</tt>
+     * @return  a pseudorandom, uniformly distributed {...@code int}
      * value between 0 (inclusive) and n (exclusive).
-     * @throws IllegalArgumentException if n is not positive.
+     * @throws NotStrictlyPositiveException if {...@code n <= 0}.
      */
     public int nextInt(int n) {
         if (n <= 0 ) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_UPPER_BOUND, n);
+            throw new NotStrictlyPositiveException(n);
         }
         int result = (int) (nextDouble() * n);
         return result < n ? result : n - 1;
     }
 
      /**
-     * Returns the next pseudorandom, uniformly distributed <code>long</code>
+     * Returns the next pseudorandom, uniformly distributed {...@code long}
      * value from this random number generator's sequence.  All
-     * 2<font size="-1"><sup>64</sup></font> possible <tt>long</tt> values
+     * 2<font size="-1"><sup>64</sup></font> possible {...@code long} values
      * should be produced with (approximately) equal probability.
      * <p>
      * The default implementation returns
@@ -173,7 +171,7 @@ public abstract class AbstractRandomGene
      * <code>(long) (nextDouble() * Long.MAX_VALUE)</code>
      * </pre></p>
      *
-     * @return  the next pseudorandom, uniformly distributed <code>long</code>
+     * @return  the next pseudorandom, uniformly distributed {...@code long}
      *value from this random number generator's sequence
      */
     public long nextLong() {
@@ -182,7 +180,7 @@ public abstract class AbstractRandomGene
 
     /**
      * Returns the next pseudorandom, uniformly distributed
-     * <code>boolean</code> value from this random number generator's
+     * {...@code boolean} value from this random number generator's
      * sequence.
      * <p>
      * The default implementation returns
@@ -191,7 +189,7 @@ public abstract class AbstractRandomGene
      * </pre></p>
      *
      * @return  the next pseudorandom, uniformly distributed
-     * <code>boolean</code> value from this random number generator's
+     * {...@code boolean} value from this random number generator's
      * sequence
      */
     public boolean nextBoolean() {
@@ -199,8 +197,8 @@ public abstract class AbstractRandomGene
     }
 
      /**
-     * Returns the next pseudorandom, uniformly distributed <code>float</code>
-     * value between <code>0.0</code> and <code>1.0</code> from this random
+     * Returns the next pseudorandom, uniformly distributed {...@code float}
+     * value between {...@code 0.0} and {...@code 1.0} from this random
      * number generator's sequence.
      * <p>
      * The default implementation returns
@@ -208,8 +206,8 @@ public abstract class AbstractRandomGene
      * <code>(float) nextDouble() </code>
      * </pre></p>
      *
-     * @return  the next pseudorandom, uniformly distributed <code>float</code>
-     * value between <code>0.0</code> and <code>1.0</code> from this
+     * @return  the next pseudorandom, uniformly distributed {...@code float}
+     * value between {...@code 0.0} and {...@code 1.0} from this
      * random number generator's sequence
      */
     public float nextFloat() {
@@ -218,22 +216,22 @@ public abstract class AbstractRandomGene
 
     /**
      * Returns the next pseudorandom, uniformly distributed
-     * <code>double</code> value between <code>0.0</code> and
-     * <code>1.0</code> from this random number generator's sequence.
+     * {...@code double} value between {...@code 0.0} and
+     * {...@code 1.0} from this random number generator's sequence.
      * <p>
      * This method provides the underlying source of random data used by the
      * other methods.</p>
      *
      * @return  the next pseudorandom, uniformly distributed
-     *  <code>double</code> value between <code>0.0</code> and
-     *  <code>1.0</code> from this random number generator's sequence
+     *  {...@code double} value between {...@code 0.0} and
+     *  {...@code 1.0} from this random number generator's sequence
      */
     public abstract double nextDouble();
 
     /**
      * Returns the next pseudorandom, Gaussian ("normally") distributed
-     * <code>double</code> value with mean <code>0.0</code> and standard
-     * deviation <code>1.0</code> from this random number generator's sequence.
+     * {...@code double} value with mean {...@code 0.0} and standard
+     * deviation {...@code 1.0} from this random number generator's sequence.
      * <p>
      * The default implementation uses the <em>Polar Method</em>
      * due to G.E.P. Box, M.E. Muller and G. Marsaglia, as described in
@@ -246,8 +244,8 @@ public abstract class AbstractRandomGene
      * implementation of {...@link #setSeed(long)}.</p>
      *
      * @return  the next pseudorandom, Gaussian ("normally") distributed
-     * <code>double</code> value with mean <code>0.0</code> and
-     * standard deviation <code>1.0</code> from this random number
+     * {...@code double} value with mean {...@code 0.0} and
+     * standard deviation {...@code 1.0} from this random number
      *  generator's sequence
      */
     public double nextGaussian() {

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/BitsStreamGenerator.java
 Fri Jul  9 13:15:28 2010
@@ -16,8 +16,7 @@
  */
 package org.apache.commons.math.random;
 
-import org.apache.commons.math.MathRuntimeException;
-import org.apache.commons.math.util.LocalizedFormats;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
 
 /** Base class for random number generators that generates bits streams.
 
@@ -123,8 +122,7 @@ public abstract class BitsStreamGenerato
     public int nextInt(int n) throws IllegalArgumentException {
 
         if (n < 1) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_UPPER_BOUND, n);
+            throw new NotStrictlyPositiveException(n);
         }
 
         // find bit mask for n

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
 Fri Jul  9 13:15:28 2010
@@ -26,6 +26,8 @@ import java.util.Collection;
 
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.apache.commons.math.exception.NumberIsTooLargeException;
 import org.apache.commons.math.distribution.BetaDistributionImpl;
 import org.apache.commons.math.distribution.BinomialDistributionImpl;
 import org.apache.commons.math.distribution.CauchyDistributionImpl;
@@ -145,11 +147,11 @@ public class RandomDataImpl implements R
      * @param len
      *            the desired string length.
      * @return the random string.
+     * @throws NotStrictlyPositiveException if {...@code len <= 0}.
      */
     public String nextHexString(int len) {
         if (len <= 0) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_LENGTH, len);
+            throw new NotStrictlyPositiveException(LocalizedFormats.LENGTH, 
len);
         }
 
         // Get a random number generator
@@ -191,12 +193,12 @@ public class RandomDataImpl implements R
      * @param upper
      *            the upper bound.
      * @return the random integer.
+     * @throws NumberIsTooLargeException if {...@code lower >= upper}.
      */
     public int nextInt(int lower, int upper) {
         if (lower >= upper) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
-                    upper, lower);
+            throw new 
NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
+                                                lower, upper, false);
         }
         double r = getRan().nextDouble();
         return (int) ((r * upper) + ((1.0 - r) * lower) + r);
@@ -211,12 +213,12 @@ public class RandomDataImpl implements R
      * @param upper
      *            the upper bound.
      * @return the random integer.
+     * @throws NumberIsTooLargeException if {...@code lower >= upper}.
      */
     public long nextLong(long lower, long upper) {
         if (lower >= upper) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
-                  upper, lower);
+            throw new 
NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
+                                                lower, upper, false);
         }
         double r = getRan().nextDouble();
         return (long) ((r * upper) + ((1.0 - r) * lower) + r);
@@ -241,11 +243,11 @@ public class RandomDataImpl implements R
      * @param len
      *            the length of the generated string
      * @return the random string
+     * @throws NotStrictlyPositiveException if {...@code len <= 0}.
      */
     public String nextSecureHexString(int len) {
         if (len <= 0) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_LENGTH, len);
+            throw new NotStrictlyPositiveException(LocalizedFormats.LENGTH, 
len);
         }
 
         // Get SecureRandom and setup Digest provider
@@ -302,12 +304,12 @@ public class RandomDataImpl implements R
      * @param upper
      *            the upper bound.
      * @return the random integer.
+     * @throws NumberIsTooLargeException if {...@code lower >= upper}.
      */
     public int nextSecureInt(int lower, int upper) {
         if (lower >= upper) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
-                  upper, lower);
+            throw new 
NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
+                                                lower, upper, false);
         }
         SecureRandom sec = getSecRan();
         return lower + (int) (sec.nextDouble() * (upper - lower + 1));
@@ -323,12 +325,12 @@ public class RandomDataImpl implements R
      * @param upper
      *            the upper bound.
      * @return the random integer.
+     * @throws NumberIsTooLargeException if {...@code lower >= upper}.
      */
     public long nextSecureLong(long lower, long upper) {
         if (lower >= upper) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
-                  upper, lower);
+            throw new 
NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
+                                                lower, upper, false);
         }
         SecureRandom sec = getSecRan();
         return lower + (long) (sec.nextDouble() * (upper - lower + 1));
@@ -349,11 +351,11 @@ public class RandomDataImpl implements R
      *
      * @param mean mean of the Poisson distribution.
      * @return the random Poisson value.
+     * @throws NotStrictlyPositiveException if {...@code mean <= 0}.
      */
     public long nextPoisson(double mean) {
         if (mean <= 0) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_POISSON_MEAN, mean);
+            throw new NotStrictlyPositiveException(LocalizedFormats.MEAN, 
mean);
         }
 
         final RandomGenerator generator = getRan();
@@ -453,11 +455,11 @@ public class RandomDataImpl implements R
      * @param sigma
      *            the standard deviation of the distribution
      * @return the random Normal value
+     * @throws NotStrictlyPositiveException if {...@code sigma <= 0}.
      */
     public double nextGaussian(double mu, double sigma) {
         if (sigma <= 0) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_STANDARD_DEVIATION, sigma);
+            throw new 
NotStrictlyPositiveException(LocalizedFormats.STANDARD_DEVIATION, sigma);
         }
         return sigma * getRan().nextGaussian() + mu;
     }
@@ -474,11 +476,11 @@ public class RandomDataImpl implements R
      *
      * @param mean the mean of the distribution
      * @return the random Exponential value
+     * @throws NotStrictlyPositiveException if {...@code mean <= 0}.
      */
     public double nextExponential(double mean) {
         if (mean <= 0.0) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_MEAN, mean);
+            throw new NotStrictlyPositiveException(LocalizedFormats.MEAN, 
mean);
         }
         final RandomGenerator generator = getRan();
         double unif = generator.nextDouble();
@@ -503,12 +505,12 @@ public class RandomDataImpl implements R
      *            the upper bound.
      * @return a uniformly distributed random value from the interval (lower,
      *         upper)
+     * @throws NumberIsTooLargeException if {...@code lower >= upper}.
      */
     public double nextUniform(double lower, double upper) {
         if (lower >= upper) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
-                  upper, lower);
+            throw new 
NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
+                                                lower, upper, false);
         }
         final RandomGenerator generator = getRan();
 
@@ -827,15 +829,17 @@ public class RandomDataImpl implements R
      * @param k
      *            size of the permutation (must satisfy 0 < k <= n).
      * @return the random permutation as an int array
+     * @throws NumberIsTooLargException if {...@code k > n}.
+     * @throws NotStrictlyPositiveException if {...@code k <= 0}.
      */
     public int[] nextPermutation(int n, int k) {
         if (k > n) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.PERMUTATION_EXCEEDS_N, k, n);
+            throw new 
NumberIsTooLargeException(LocalizedFormats.PERMUTATION_EXCEEDS_N,
+                                                k, n, true);
         }
         if (k == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_PERMUTATION, k);
+            throw new 
NotStrictlyPositiveException(LocalizedFormats.PERMUTATION_SIZE,
+                                                   k);
         }
 
         int[] index = getNatural(n);
@@ -863,16 +867,17 @@ public class RandomDataImpl implements R
      * @param k
      *            sample size.
      * @return the random sample.
+     * @throws NumberIsTooLargeException if {...@code k > c.size()}.
+     * @throws NotStrictlyPositiveException if {...@code k <= 0}.
      */
     public Object[] nextSample(Collection<?> c, int k) {
         int len = c.size();
         if (k > len) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE);
+            throw new 
NumberIsTooLargeException(LocalizedFormats.SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE,
+                                                k, len, true);
         }
         if (k <= 0) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_POSITIVE_SAMPLE_SIZE, k);
+            throw new 
NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES, k);
         }
 
         Object[] objects = c.toArray();

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/UncorrelatedRandomVectorGenerator.java
 Fri Jul  9 13:15:28 2010
@@ -19,8 +19,7 @@ package org.apache.commons.math.random;
 
 import java.util.Arrays;
 
-import org.apache.commons.math.MathRuntimeException;
-import org.apache.commons.math.util.LocalizedFormats;
+import org.apache.commons.math.exception.DimensionMismatchException;
 
 /**
  * A {...@link RandomVectorGenerator} that generates vectors with uncorrelated
@@ -55,9 +54,7 @@ public class UncorrelatedRandomVectorGen
                                            double[] standardDeviation,
                                            NormalizedRandomGenerator 
generator) {
     if (mean.length != standardDeviation.length) {
-      throw MathRuntimeException.createIllegalArgumentException(
-            LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
-            mean.length, standardDeviation.length);
+        throw new DimensionMismatchException(mean.length, 
standardDeviation.length);
     }
     this.mean              = mean.clone();
     this.standardDeviation = standardDeviation.clone();

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/LocalizedFormats.java
 Fri Jul  9 13:15:28 2010
@@ -84,7 +84,7 @@ public enum LocalizedFormats implements 
     DISCRETE_CUMULATIVE_PROBABILITY_RETURNED_NAN("Discrete cumulative 
probability function returned NaN for argument {0}"),
     DISTRIBUTION_NOT_LOADED("distribution not loaded"),
     DUPLICATED_ABSCISSA("Abscissa {0} is duplicated at both indices {1} and 
{2}"),
-    EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY("empty polynomials coefficients 
array"),
+    EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY("empty polynomials coefficients 
array"), /* keep */
     EMPTY_SELECTED_COLUMN_INDEX_ARRAY("empty selected column index array"),
     EMPTY_SELECTED_ROW_INDEX_ARRAY("empty selected row index array"),
     EMPTY_STRING_FOR_IMAGINARY_CHARACTER("empty string for imaginary 
character"),
@@ -131,7 +131,7 @@ public enum LocalizedFormats implements 
     LCM_OVERFLOW_32_BITS("overflow: lcm({0}, {1}) is 2^31"),
     LCM_OVERFLOW_64_BITS("overflow: lcm({0}, {1}) is 2^63"),
     LOESS_EXPECTS_AT_LEAST_ONE_POINT("Loess expects at least 1 point"),
-    LOWER_BOUND_NOT_BELOW_UPPER_BOUND("upper bound ({0}) must be greater than 
lower bound ({1})"),
+    LOWER_BOUND_NOT_BELOW_UPPER_BOUND("lower bound ({0}) must be strictly less 
than upper bound ({1})"), /* keep */
     LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT("lower endpoint ({0}) must be less 
than or equal to upper endpoint ({1})"),
     MAP_MODIFIED_WHILE_ITERATING("map has been modified while iterating"),
     MAX_EVALUATIONS_EXCEEDED("maximal number of evaluations ({0}) exceeded"),
@@ -174,9 +174,13 @@ public enum LocalizedFormats implements 
     NOT_POSITIVE_ELEMENT_AT_INDEX("element {0} is not positive: {1}"),
     NOT_POSITIVE_EXPONENT("invalid exponent {0} (must be positive)"),
     NOT_POSITIVE_LENGTH("length must be positive ({0})"),
+    LENGTH("length ({0})"), /* keep */
     NOT_POSITIVE_MEAN("mean must be positive ({0})"),
+    MEAN("mean ({0})"), /* keep */
     NOT_POSITIVE_NUMBER_OF_SAMPLES("number of sample is not positive: {0}"),
+    NUMBER_OF_SAMPLES("number of samples ({0})"), /* keep */
     NOT_POSITIVE_PERMUTATION("permutation k ({0}) must be positive"),
+    PERMUTATION_SIZE("permutation size ({0}"), /* keep */
     NOT_POSITIVE_POISSON_MEAN("the Poisson mean must be positive ({0})"),
     NOT_POSITIVE_POPULATION_SIZE("population size must be positive ({0})"),
     NOT_POSITIVE_ROW_DIMENSION("invalid row dimension: {0} (must be 
positive)"),
@@ -184,6 +188,7 @@ public enum LocalizedFormats implements 
     NOT_POSITIVE_SCALE("scale must be positive ({0})"),
     NOT_POSITIVE_SHAPE("shape must be positive ({0})"),
     NOT_POSITIVE_STANDARD_DEVIATION("standard deviation must be positive 
({0})"),
+    STANDARD_DEVIATION("standard deviation ({0})"), /* keep */
     NOT_POSITIVE_UPPER_BOUND("upper bound must be positive ({0})"),
     NOT_POSITIVE_WINDOW_SIZE("window size must be positive ({0})"),
     NOT_POWER_OF_TWO("{0} is not a power of 2"),
@@ -234,7 +239,7 @@ public enum LocalizedFormats implements 
     OVERFLOW_IN_FRACTION("overflow in fraction {0}/{1}, cannot negate"),
     PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD("cannot access {0} method 
in percentile implementation {1}"),
     PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD("percentile implementation 
{0} does not support {1}"),
-    PERMUTATION_EXCEEDS_N("permutation k ({0}) exceeds n ({1})"),
+    PERMUTATION_EXCEEDS_N("permutation size ({0}) exceeds permuation domain 
({1})"), /* keep */
     POLYNOMIAL_INTERPOLANTS_MISMATCH_SEGMENTS("number of polynomial 
interpolants must match the number of segments ({0} != {1} - 1)"),
     POSITION_SIZE_MISMATCH_INPUT_ARRAY("position {0} and size {1} don't fit to 
the size of the input array {2}"),
     POWER_NEGATIVE_PARAMETERS("cannot raise an integral value to a negative 
power ({0}^{1})"),
@@ -244,7 +249,7 @@ public enum LocalizedFormats implements 
     ROTATION_MATRIX_DIMENSIONS("a {0}x{1} matrix cannot be a rotation matrix"),
     ROW_INDEX_OUT_OF_RANGE("row index {0} out of allowed range [{1}, {2}]"),
     SAME_SIGN_AT_ENDPOINTS("function values at endpoints do not have different 
signs, endpoints: [{0}, {1}], values: [{2}, {3}]"),
-    SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE("sample size ({0}) exceeds collection 
size ({1})"),
+    SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE("sample size ({0}) exceeds collection 
size ({1})"), /* keep */
     SAMPLE_SIZE_LARGER_THAN_POPULATION_SIZE("sample size ({0}) must be less 
than or equal to population size ({1})"),
     SIMPLEX_NEED_ONE_POINT("simplex must contain at least one point"),
     SIMPLE_MESSAGE("{0}"),

Modified: 
commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties?rev=962515&r1=962514&r2=962515&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
 (original)
+++ 
commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
 Fri Jul  9 13:15:28 2010
@@ -103,7 +103,7 @@ ITERATOR_EXHAUSTED = it\u00e9ration ache
 LCM_OVERFLOW_32_BITS = d\u00e9passement de capacit\u00e9 : le MCM de {0} et 
{1} vaut 2^31
 LCM_OVERFLOW_64_BITS = d\u00e9passement de capacit\u00e9 : le MCM de {0} et 
{1} vaut 2^63
 LOESS_EXPECTS_AT_LEAST_ONE_POINT = la r\u00e9gression Loess n\u00e9cessite au 
moins un point
-LOWER_BOUND_NOT_BELOW_UPPER_BOUND = la borne sup\u00e9rieure ({0}) doit 
\u00eatre sup\u00e9rieure
+LOWER_BOUND_NOT_BELOW_UPPER_BOUND = la borne inf\u00e9rieure ({0}) doit 
\u00eatre strictement plus petite que la borne sup\u00e9rieure ({1})
 LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT = la borne inf\u00e9rieure ({0}) devrait 
\u00eatre inf\u00e9rieure 
 MAP_MODIFIED_WHILE_ITERATING = la table d''adressage a \u00e9t\u00e9 
modifi\u00e9e pendant l''it\u00e9ration
 MAX_EVALUATIONS_EXCEEDED = nombre maximal d''\u00e9valuations ({0}) 
d\u00e9pass\u00e9
@@ -146,9 +146,13 @@ NOT_POSITIVE_DEGREES_OF_FREEDOM = les de
 NOT_POSITIVE_ELEMENT_AT_INDEX = l''\u00e9l\u00e9ment {0} n''est pas positif : 
{1}
 NOT_POSITIVE_EXPONENT = exposant {0} invalide (doit \u00eatre positif)
 NOT_POSITIVE_LENGTH = la longueur doit \u00eatre positive ({0})
+LENGTH = longueur ({0})
 NOT_POSITIVE_MEAN = la moyenne doit \u00eatre positive ({0})
+MEAN = moyenne ({0})
 NOT_POSITIVE_NUMBER_OF_SAMPLES = le nombre d''\u00e9chantillons n''est pas 
positif : {0}
+NUMBER_OF_SAMPLES = nombre d''\u00e9chantillons ({0})
 NOT_POSITIVE_PERMUTATION = la permutation k ({0}) doit \u00eatre positive
+PERMUTATION_SIZE = taille de la permutation
 NOT_POSITIVE_POISSON_MEAN = la moyenne de Poisson doit \u00eatre positive ({0})
 NOT_POSITIVE_POPULATION_SIZE = la taille de la population doit \u00eatre 
positive ({0})
 NOT_POSITIVE_ROW_DIMENSION = nombre de lignes invalide : {0} (doit \u00eatre 
positif)
@@ -156,6 +160,7 @@ NOT_POSITIVE_SAMPLE_SIZE = la taille de 
 NOT_POSITIVE_SCALE = l''\u00e9chelle doit \u00eatre positive ({0})
 NOT_POSITIVE_SHAPE = le facteur de forme doit \u00eatre positif ({0})
 NOT_POSITIVE_STANDARD_DEVIATION = l''\u00e9cart type doit \u00eatre positif 
({0})
+STANDARD_DEVIATION = \u00e9cart type
 NOT_POSITIVE_UPPER_BOUND = la borne sup\u00e9rieure doit \u00eatre positive 
({0})
 NOT_POSITIVE_WINDOW_SIZE = la taille de la fen\u00eatre doit \u00eatre 
positive ({0})
 NOT_POWER_OF_TWO = {0} n''est pas une puissance de 2
@@ -206,7 +211,7 @@ OUT_OF_RANGE_SIMPLE = {0} hors du domain
 OVERFLOW_IN_FRACTION = d\u00e9passement de capacit\u00e9 pour la fraction 
{0}/{1}, son signe ne peut \u00eatre chang\u00e9
 PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD = acc\u00e8s impossible \u00e0 
la m\u00e9thode {0}
 PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD = l''implantation de pourcentage 
{0} ne dispose pas de la m\u00e9thode {1}
-PERMUTATION_EXCEEDS_N = la permutation k ({0}) d\u00e9passe n ({1})
+PERMUTATION_EXCEEDS_N = la taille de la permutation ({0}) d\u00e9passe le 
domaine de la permutation ({1})
 POLYNOMIAL_INTERPOLANTS_MISMATCH_SEGMENTS = le nombre d''interpolants 
polyn\u00f4miaux doit correspondre au nombre de segments ({0} != {1} - 1)
 POSITION_SIZE_MISMATCH_INPUT_ARRAY = la position {0} et la taille {1} sont 
incompatibles avec la taille du tableau d''entr\u00e9e {2}
 POWER_NEGATIVE_PARAMETERS = impossible d''\u00e9lever une valeur enti\u00e8re 


Reply via email to