commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r955423 [2/6] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/ main/java/org/apache/commons/math/analysis/integration/ main/java/org/apache/commons/math/analysis/interpolation/ main/java/org/apache/commons/math/analys...
Date Wed, 16 Jun 2010 23:03:42 GMT
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java Wed Jun 16 23:03:38 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.analysis
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.polynomials.PolynomialFunction;
 import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Computes a natural (also known as "free", "unclamped") cubic spline interpolation for the data set.
@@ -58,12 +59,12 @@ public class SplineInterpolator implemen
     public PolynomialSplineFunction interpolate(double x[], double y[]) {
         if (x.length != y.length) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "dimension mismatch {0} != {1}", x.length, y.length);
+                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, x.length, y.length);
         }
 
         if (x.length < 3) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "{0} points are required, got only {1}", 3, x.length);
+                  LocalizedFormats.WRONG_NUMBER_OF_POINTS, 3, x.length);
         }
 
         // Number of intervals.  The number of data points is n + 1.
@@ -72,7 +73,7 @@ public class SplineInterpolator implemen
         for (int i = 0; i < n; i++) {
             if (x[i]  >= x[i + 1]) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      "points {0} and {1} are not strictly increasing ({2} >= {3})",
+                      LocalizedFormats.NOT_STRICTLY_INCREASING_NUMBER_OF_POINTS,
                       i, i+1, x[i], x[i+1]);
             }
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java Wed Jun 16 23:03:38 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.math.analysis.interpolation;
 
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.DimensionMismatchException;
@@ -156,7 +157,7 @@ public class TricubicSplineInterpolating
 
         if (xLen == 0 || yLen == 0 || z.length == 0
             || f.length == 0 || f[0].length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("no data");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NO_DATA);
         }
         if (xLen != f.length) {
             throw new DimensionMismatchException(xLen, f.length);
@@ -307,18 +308,21 @@ public class TricubicSplineInterpolating
     public double value(double x, double y, double z) {
         final int i = searchIndex(x, xval);
         if (i == -1) {
-            throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",
-                                                                      x, xval[0], xval[xval.length - 1]);
+            throw MathRuntimeException.createIllegalArgumentException(
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE,
+                  x, xval[0], xval[xval.length - 1]);
         }
         final int j = searchIndex(y, yval);
         if (j == -1) {
-            throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",
-                                                                      y, yval[0], yval[yval.length - 1]);
+            throw MathRuntimeException.createIllegalArgumentException(
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE,
+                  y, yval[0], yval[yval.length - 1]);
         }
         final int k = searchIndex(z, zval);
         if (k == -1) {
-            throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",
-                                                                      z, zval[0], zval[zval.length - 1]);
+            throw MathRuntimeException.createIllegalArgumentException(
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE,
+                  z, zval[0], zval[zval.length - 1]);
         }
 
         final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]);
@@ -449,15 +453,15 @@ class TricubicSplineFunction
      */
     public double value(double x, double y, double z) {
         if (x < 0 || x > 1) {
-            throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                                                                       x, 0, 1);
         }
         if (y < 0 || y > 1) {
-            throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                                                                       y, 0, 1);
         }
         if (z < 0 || z > 1) {
-            throw MathRuntimeException.createIllegalArgumentException("{0} out of [{1}, {2}] range",
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                                                                       z, 0, 1);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolator.java Wed Jun 16 23:03:38 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.analysis
 import org.apache.commons.math.DimensionMismatchException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -38,7 +39,7 @@ public class TricubicSplineInterpolator
                                                            final double[][][] fval)
         throws MathException, IllegalArgumentException {
         if (xval.length == 0 || yval.length == 0 || zval.length == 0 || fval.length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("no data");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NO_DATA);
         }
         if (xval.length != fval.length) {
             throw new DimensionMismatchException(xval.length, fval.length);

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=955423&r1=955422&r2=955423&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 Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Immutable representation of a real polynomial function with real coefficients.
@@ -33,10 +34,6 @@ import org.apache.commons.math.analysis.
  */
 public class PolynomialFunction implements DifferentiableUnivariateRealFunction, Serializable {
 
-    /** Message for empty coefficients array. */
-    private static final String EMPTY_ARRAY_MESSAGE =
-        "empty polynomials coefficients array";
-
     /**
      * Serialization identifier
      */
@@ -66,7 +63,7 @@ public class PolynomialFunction implemen
     public PolynomialFunction(double c[]) {
         super();
         if (c.length < 1) {
-            throw MathRuntimeException.createIllegalArgumentException(EMPTY_ARRAY_MESSAGE);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
         }
         int l = c.length;
         while ((l > 1) && (c[l - 1] == 0)) {
@@ -126,7 +123,7 @@ public class PolynomialFunction implemen
     protected static double evaluate(double[] coefficients, double argument) {
         int n = coefficients.length;
         if (n < 1) {
-            throw MathRuntimeException.createIllegalArgumentException(EMPTY_ARRAY_MESSAGE);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
         }
         double result = coefficients[n - 1];
         for (int j = n -2; j >=0; j--) {
@@ -235,7 +232,7 @@ public class PolynomialFunction implemen
     protected static double[] differentiate(double[] coefficients) {
         int n = coefficients.length;
         if (n < 1) {
-            throw MathRuntimeException.createIllegalArgumentException(EMPTY_ARRAY_MESSAGE);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
         }
         if (n == 1) {
             return new double[]{0};

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ import org.apache.commons.math.Duplicate
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implements the representation of a real polynomial function in
@@ -90,7 +91,7 @@ public class PolynomialFunctionLagrangeF
         try {
             return evaluate(x, y, z);
         } catch (DuplicateSampleAbscissaException e) {
-            throw new FunctionEvaluationException(e, z, e.getPattern(), e.getArguments());
+            throw new FunctionEvaluationException(e, z, e.getLocalizablePattern(), e.getArguments());
         }
     }
 
@@ -297,12 +298,12 @@ public class PolynomialFunctionLagrangeF
 
         if (x.length != y.length) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "dimension mismatch {0} != {1}", x.length, y.length);
+                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, x.length, y.length);
         }
 
         if (x.length < 2) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "{0} points are required, got only {1}", 2, x.length);
+                  LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length);
         }
 
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java Wed Jun 16 23:03:38 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.analysis
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implements the representation of a real polynomial function in
@@ -209,11 +210,11 @@ public class PolynomialFunctionNewtonFor
 
         if (a.length < 1 || c.length < 1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "empty polynomials coefficients array");
+                  LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
         }
         if (a.length != c.length + 1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "array sizes should have difference 1 ({0} != {1} + 1)",
+                  LocalizedFormats.ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1,
                   a.length, c.length);
         }
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import org.apache.commons.math.ArgumentO
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Represents a polynomial spline function.
@@ -97,17 +98,17 @@ public class PolynomialSplineFunction
     public PolynomialSplineFunction(double knots[], PolynomialFunction polynomials[]) {
         if (knots.length < 2) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "spline partition must have at least {0} points, got {1}",
+                  LocalizedFormats.NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION,
                   2, knots.length);
         }
         if (knots.length - 1 != polynomials.length) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "number of polynomial interpolants must match the number of segments ({0} != {1} - 1)",
+                  LocalizedFormats.POLYNOMIAL_INTERPOLANTS_MISMATCH_SEGMENTS,
                   polynomials.length, knots.length);
         }
         if (!isStrictlyIncreasing(knots)) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "knot values must be strictly increasing");
+                  LocalizedFormats.NOT_STRICTLY_INCREASING_KNOT_VALUES);
         }
 
         this.n = knots.length -1;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/BrentsMethod.html">
@@ -43,11 +44,6 @@ public class BrentSolver extends Univari
      */
     public static final int DEFAULT_MAXIMUM_ITERATIONS = 100;
 
-    /** Error message for non-bracketing interval. */
-    private static final String NON_BRACKETING_MESSAGE =
-        "function values at endpoints do not have different signs.  " +
-        "Endpoints: [{0}, {1}], Values: [{2}, {3}]";
-
     /** Serializable version identifier */
     private static final long serialVersionUID = 7694577816772532779L;
 
@@ -134,7 +130,7 @@ public class BrentSolver extends Univari
         clearResult();
         if ((initial < min) || (initial > max)) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "invalid interval, initial value parameters:  lower={0}, initial={1}, upper={2}",
+                  LocalizedFormats.INVALID_INTERVAL_INITIAL_VALUE_PARAMETERS,
                   min, initial, max);
         }
 
@@ -170,7 +166,7 @@ public class BrentSolver extends Univari
         }
 
         throw MathRuntimeException.createIllegalArgumentException(
-              NON_BRACKETING_MESSAGE, min, max, yMin, yMax);
+              LocalizedFormats.SAME_SIGN_AT_ENDPOINTS, min, max, yMin, yMax);
 
     }
 
@@ -217,7 +213,7 @@ public class BrentSolver extends Univari
             } else {
                 // neither value is close to zero and min and max do not bracket root.
                 throw MathRuntimeException.createIllegalArgumentException(
-                        NON_BRACKETING_MESSAGE, min, max, yMin, yMax);
+                        LocalizedFormats.SAME_SIGN_AT_ENDPOINTS, min, max, yMin, yMax);
             }
         } else if (sign < 0){
             // solve using only the first endpoint as initial guess

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java Wed Jun 16 23:03:38 2010
@@ -23,6 +23,7 @@ import org.apache.commons.math.MaxIterat
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.polynomials.PolynomialFunction;
 import org.apache.commons.math.complex.Complex;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/LaguerresMethod.html">
@@ -38,14 +39,6 @@ import org.apache.commons.math.complex.C
  */
 public class LaguerreSolver extends UnivariateRealSolverImpl {
 
-    /** Message for non-polynomial function. */
-    private static final String NON_POLYNOMIAL_FUNCTION_MESSAGE =
-        "function is not polynomial";
-
-    /** Message for non-positive degree. */
-    private static final String NON_POSITIVE_DEGREE_MESSAGE =
-        "polynomial degree must be positive: degree={0}";
-
     /** polynomial function to solve.
      * @deprecated as of 2.0 the function is not stored anymore in the instance
      */
@@ -69,7 +62,7 @@ public class LaguerreSolver extends Univ
         if (f instanceof PolynomialFunction) {
             p = (PolynomialFunction) f;
         } else {
-            throw MathRuntimeException.createIllegalArgumentException(NON_POLYNOMIAL_FUNCTION_MESSAGE);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.FUNCTION_NOT_POLYNOMIAL);
         }
     }
 
@@ -172,7 +165,7 @@ public class LaguerreSolver extends Univ
 
         // check function type
         if (!(f instanceof PolynomialFunction)) {
-            throw MathRuntimeException.createIllegalArgumentException(NON_POLYNOMIAL_FUNCTION_MESSAGE);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.FUNCTION_NOT_POLYNOMIAL);
         }
 
         // check for zeros before verifying bracketing
@@ -265,7 +258,7 @@ public class LaguerreSolver extends Univ
         int iterationCount = 0;
         if (n < 1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  NON_POSITIVE_DEGREE_MESSAGE, n);
+                  LocalizedFormats.NON_POSITIVE_POLYNOMIAL_DEGREE, n);
         }
         Complex c[] = new Complex[n+1];    // coefficients for deflated polynomial
         for (int i = 0; i <= n; i++) {
@@ -313,7 +306,7 @@ public class LaguerreSolver extends Univ
         int n = coefficients.length - 1;
         if (n < 1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  NON_POSITIVE_DEGREE_MESSAGE, n);
+                  LocalizedFormats.NON_POSITIVE_POLYNOMIAL_DEGREE, n);
         }
         Complex N  = new Complex(n,     0.0);
         Complex N1 = new Complex(n - 1, 0.0);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import org.apache.commons.math.MathRunti
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implements <a href="http://mathworld.wolfram.com/NewtonsMethod.html">
@@ -129,7 +130,7 @@ public class NewtonSolver extends Univar
 
             throw new MaxIterationsExceededException(maximalIterationCount);
         } catch (ClassCastException cce) {
-            throw MathRuntimeException.createIllegalArgumentException("function is not differentiable");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.FUNCTION_NOT_DIFFERENTIABLE);
         }
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 
 /**
@@ -127,9 +128,7 @@ public class SecantSolver extends Univar
         // Verify bracketing
         if (y0 * y1 >= 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "function values at endpoints do not have different signs, " +
-                  "endpoints: [{0}, {1}], values: [{2}, {3}]",
-                  min, max, y0, y1);
+                  LocalizedFormats.SAME_SIGN_AT_ENDPOINTS, min, max, y0, y1);
         }
 
         double x2 = x0;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.Convergin
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Provide a default implementation for several functions useful to generic
@@ -73,7 +74,7 @@ public abstract class UnivariateRealSolv
                                        final double defaultAbsoluteAccuracy) {
         super(defaultMaximalIterationCount, defaultAbsoluteAccuracy);
         if (f == null) {
-            throw MathRuntimeException.createIllegalArgumentException("function to solve cannot be null");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NULL_FUNCTION);
         }
         this.f = f;
         this.defaultFunctionValueAccuracy = 1.0e-15;
@@ -100,7 +101,7 @@ public abstract class UnivariateRealSolv
      */
     protected void checkResultComputed() throws IllegalStateException {
         if (!resultComputed) {
-            throw MathRuntimeException.createIllegalStateException("no result available");
+            throw MathRuntimeException.createIllegalStateException(LocalizedFormats.NO_RESULT_AVAILABLE);
         }
     }
 
@@ -224,7 +225,7 @@ public abstract class UnivariateRealSolv
     protected void verifySequence(final double lower, final double initial, final double upper) {
         if (!isSequence(lower, initial, upper)) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid interval, initial value parameters:  lower={0}, initial={1}, upper={2}",
+                    LocalizedFormats.INVALID_INTERVAL_INITIAL_VALUE_PARAMETERS,
                     lower, initial, upper);
         }
     }
@@ -247,8 +248,7 @@ public abstract class UnivariateRealSolv
         verifyInterval(lower, upper);
         if (!isBracketing(lower, upper, function)) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "function values at endpoints do not have different signs.  " +
-                    "Endpoints: [{0}, {1}], Values: [{2}, {3}]",
+                    LocalizedFormats.SAME_SIGN_AT_ENDPOINTS,
                     lower, upper, function.value(lower), function.value(upper));
         }
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Utility routines for {@link UnivariateRealSolver} objects.
@@ -28,10 +29,6 @@ import org.apache.commons.math.analysis.
  */
 public class UnivariateRealSolverUtils {
 
-    /** Message for null function.*/
-    private static final String NULL_FUNCTION_MESSAGE =
-        "function is null";
-
     /**
      * Default constructor.
      */
@@ -173,15 +170,15 @@ public class UnivariateRealSolverUtils {
             FunctionEvaluationException {
 
         if (function == null) {
-            throw MathRuntimeException.createIllegalArgumentException(NULL_FUNCTION_MESSAGE);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NULL_FUNCTION);
         }
         if (maximumIterations <= 0)  {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "bad value for maximum iterations number: {0}", maximumIterations);
+                  LocalizedFormats.INVALID_MAX_ITERATIONS, maximumIterations);
         }
         if (initial < lowerBound || initial > upperBound || lowerBound >= upperBound) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "invalid bracketing parameters:  lower bound={0},  initial={1}, upper bound={2}",
+                  LocalizedFormats.INVALID_BRACKETING_PARAMETERS,
                   lowerBound, initial, upperBound);
         }
         double a = initial;
@@ -202,9 +199,7 @@ public class UnivariateRealSolverUtils {
 
         if (fa * fb > 0.0 ) {
             throw new ConvergenceException(
-                      "number of iterations={0}, maximum iterations={1}, " +
-                      "initial={2}, lower bound={3}, upper bound={4}, final a value={5}, " +
-                      "final b value={6}, f(a)={7}, f(b)={8}",
+                      LocalizedFormats.FAILED_BRACKETING,
                       numIterations, maximumIterations, initial,
                       lowerBound, upperBound, a, b, fa, fb);
         }
@@ -230,7 +225,7 @@ public class UnivariateRealSolverUtils {
      */
     private static void setup(UnivariateRealFunction f) {
         if (f == null) {
-            throw MathRuntimeException.createIllegalArgumentException(NULL_FUNCTION_MESSAGE);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NULL_FUNCTION);
         }
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java Wed Jun 16 23:03:38 2010
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -941,7 +942,7 @@ public class Complex implements FieldEle
 
         if (n <= 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "cannot compute nth root for null or negative n: {0}",
+                    LocalizedFormats.CANNOT_COMPUTE_NTH_ROOT_FOR_NEGATIVE_N,
                     n);
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexFormat.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexFormat.java Wed Jun 16 23:03:38 2010
@@ -25,6 +25,7 @@ import java.util.Locale;
 
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.util.CompositeFormat;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Formats a Complex number in cartesian format "Re(c) + Im(c)i".  'i' can
@@ -192,7 +193,7 @@ public class ComplexFormat extends Compo
                 toAppendTo, pos);
         } else {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "cannot format a {0} instance as a complex number",
+                  LocalizedFormats.CANNOT_FORMAT_INSTANCE_AS_COMPLEX,
                   obj.getClass().getName());
         }
 
@@ -349,7 +350,7 @@ public class ComplexFormat extends Compo
     public void setImaginaryCharacter(String imaginaryCharacter) {
         if (imaginaryCharacter == null || imaginaryCharacter.length() == 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "empty string for imaginary character");
+                  LocalizedFormats.EMPTY_STRING_FOR_IMAGINARY_CHARACTER);
         }
         this.imaginaryCharacter = imaginaryCharacter;
     }
@@ -363,7 +364,7 @@ public class ComplexFormat extends Compo
     public void setImaginaryFormat(NumberFormat imaginaryFormat) {
         if (imaginaryFormat == null) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "null imaginary format");
+                  LocalizedFormats.NULL_IMAGINARY_FORMAT);
         }
         this.imaginaryFormat = imaginaryFormat;
     }
@@ -377,7 +378,7 @@ public class ComplexFormat extends Compo
     public void setRealFormat(NumberFormat realFormat) {
         if (realFormat == null) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "null real format");
+                  LocalizedFormats.NULL_REAL_FORMAT);
         }
         this.realFormat = realFormat;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.complex;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Static implementations of common
@@ -62,7 +63,7 @@ public class ComplexUtils {
     public static Complex polar2Complex(double r, double theta) {
         if (r < 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "negative complex module {0}", r);
+                  LocalizedFormats.NEGATIVE_COMPLEX_MODULE, r);
         }
         return new Complex(r * Math.cos(theta), r * Math.sin(theta));
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java Wed Jun 16 23:03:38 2010
@@ -26,6 +26,7 @@ import org.apache.commons.math.analysis.
 import org.apache.commons.math.analysis.solvers.BrentSolver;
 import org.apache.commons.math.analysis.solvers.UnivariateRealSolverUtils;
 import org.apache.commons.math.random.RandomDataImpl;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Base class for continuous distributions.  Default implementations are
@@ -69,7 +70,7 @@ public abstract class AbstractContinuous
      */
     public double density(double x) throws MathRuntimeException {
         throw new MathRuntimeException(new UnsupportedOperationException(),
-                "This distribution does not have a density function implemented");
+                LocalizedFormats.NO_DENSITY_FOR_THIS_DISTRIBUTION);
     }
 
     /**
@@ -87,7 +88,7 @@ public abstract class AbstractContinuous
         throws MathException {
         if (p < 0.0 || p > 1.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "{0} out of [{1}, {2}] range", p, 0.0, 1.0);
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE, p, 0.0, 1.0);
         }
 
         // by default, do simple root finding using bracketing and default solver.
@@ -99,11 +100,11 @@ public abstract class AbstractContinuous
                 try {
                     ret = cumulativeProbability(x) - p;
                 } catch (MathException ex) {
-                    throw new FunctionEvaluationException(ex, x, ex.getPattern(), ex.getArguments());
+                    throw new FunctionEvaluationException(ex, x, ex.getLocalizablePattern(), ex.getArguments());
                 }
                 if (Double.isNaN(ret)) {
                     throw new FunctionEvaluationException(x,
-                        "Cumulative probability function returned NaN for argument {0} p = {1}", x, p);
+                        LocalizedFormats.CUMULATIVE_PROBABILITY_RETURNED_NAN, x, p);
                 }
                 return ret;
             }
@@ -176,7 +177,7 @@ public abstract class AbstractContinuous
      */
     public double[] sample(int sampleSize) throws MathException {
         if (sampleSize <= 0) {
-            MathRuntimeException.createIllegalArgumentException("Sample size must be positive");
+            MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NOT_POSITIVE_SAMPLE_SIZE, sampleSize);
         }
         double[] out = new double[sampleSize];
         for (int i = 0; i < sampleSize; i++) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ import java.io.Serializable;
 
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Base class for probability distributions.
@@ -60,7 +61,7 @@ public abstract class AbstractDistributi
         throws MathException {
         if (x0 > x1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "lower endpoint ({0}) must be less than or equal to upper endpoint ({1})",
+                  LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
                   x0, x1);
         }
         return cumulativeProbability(x1) - cumulativeProbability(x0);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import org.apache.commons.math.FunctionE
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.random.RandomDataImpl;
+import org.apache.commons.math.util.LocalizedFormats;
 
 
 /**
@@ -34,15 +35,7 @@ import org.apache.commons.math.random.Ra
 public abstract class AbstractIntegerDistribution extends AbstractDistribution
     implements IntegerDistribution, Serializable {
 
-    /** Message for endpoints in wrong order. */
-    private static final String WRONG_ORDER_ENDPOINTS_MESSAGE =
-        "lower endpoint ({0}) must be less than or equal to upper endpoint ({1})";
-
-    /** Message for out of range point. */
-    private static final String OUT_OF_RANGE_POINT =
-        "{0} out of [{1}, {2}] range";
-
-    /** Serializable version identifier */
+   /** Serializable version identifier */
     private static final long serialVersionUID = -1146319659338487221L;
 
     /**
@@ -95,7 +88,7 @@ public abstract class AbstractIntegerDis
         throws MathException {
         if (x0 > x1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  WRONG_ORDER_ENDPOINTS_MESSAGE, x0, x1);
+                  LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT, x0, x1);
         }
         if (Math.floor(x0) < x0) {
             return cumulativeProbability(((int) Math.floor(x0)) + 1,
@@ -152,7 +145,7 @@ public abstract class AbstractIntegerDis
     public double cumulativeProbability(int x0, int x1) throws MathException {
         if (x0 > x1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  WRONG_ORDER_ENDPOINTS_MESSAGE, x0, x1);
+                  LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT, x0, x1);
         }
         return cumulativeProbability(x1) - cumulativeProbability(x0 - 1);
     }
@@ -171,7 +164,7 @@ public abstract class AbstractIntegerDis
     public int inverseCumulativeProbability(final double p) throws MathException{
         if (p < 0.0 || p > 1.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  OUT_OF_RANGE_POINT, p, 0.0, 1.0);
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE, p, 0.0, 1.0);
         }
 
         // by default, do simple bisection.
@@ -250,7 +243,7 @@ public abstract class AbstractIntegerDis
      */
     public int[] sample(int sampleSize) throws MathException {
         if (sampleSize <= 0) {
-            MathRuntimeException.createIllegalArgumentException("Sample size must be positive");
+            MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NOT_POSITIVE_SAMPLE_SIZE, sampleSize);
         }
         int[] out = new int[sampleSize];
         for (int i = 0; i < sampleSize; i++) {
@@ -274,11 +267,11 @@ public abstract class AbstractIntegerDis
         try {
             result = cumulativeProbability(argument);
         } catch (MathException ex) {
-            throw new FunctionEvaluationException(ex, argument, ex.getPattern(), ex.getArguments());
+            throw new FunctionEvaluationException(ex, argument, ex.getLocalizablePattern(), ex.getArguments());
         }
         if (Double.isNaN(result)) {
             throw new FunctionEvaluationException(argument,
-                "Discrete cumulative probability function returned NaN for argument {0}", argument);
+                LocalizedFormats.DISCRETE_CUMULATIVE_PROBABILITY_RETURNED_NAN, argument);
         }
         return result;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.special.Beta;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * The default implementation of {@link BinomialDistribution}.
@@ -92,7 +93,7 @@ public class BinomialDistributionImpl ex
     private void setNumberOfTrialsInternal(int trials) {
         if (trials < 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "number of trials must be non-negative ({0})", trials);
+                    LocalizedFormats.NEGATIVE_NUMBER_OF_TRIALS, trials);
         }
         numberOfTrials = trials;
     }
@@ -119,7 +120,7 @@ public class BinomialDistributionImpl ex
     private void setProbabilityOfSuccessInternal(double p) {
         if (p < 0.0 || p > 1.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "{0} out of [{1}, {2}] range", p, 0.0, 1.0);
+                    LocalizedFormats.OUT_OF_RANGE_SIMPLE, p, 0.0, 1.0);
         }
         probabilityOfSuccess = p;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.distribu
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Default implementation of
@@ -136,7 +137,7 @@ public class CauchyDistributionImpl exte
         double ret;
         if (p < 0.0 || p > 1.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "{0} out of [{1}, {2}] range", p, 0.0, 1.0);
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE, p, 0.0, 1.0);
         } else if (p == 0) {
             ret = Double.NEGATIVE_INFINITY;
         } else  if (p == 1) {
@@ -182,7 +183,7 @@ public class CauchyDistributionImpl exte
     private void setScaleInternal(double s) {
         if (s <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "scale must be positive ({0})", s);
+                  LocalizedFormats.NOT_POSITIVE_SCALE, s);
         }
         scale = s;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ import java.io.Serializable;
 
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * The default implementation of {@link ExponentialDistribution}.
@@ -83,7 +84,7 @@ public class ExponentialDistributionImpl
     private void setMeanInternal(double newMean) {
         if (newMean <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "mean must be positive ({0})", newMean);
+                  LocalizedFormats.NOT_POSITIVE_MEAN, newMean);
         }
         this.mean = newMean;
     }
@@ -165,7 +166,7 @@ public class ExponentialDistributionImpl
 
         if (p < 0.0 || p > 1.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "{0} out of [{1}, {2}] range", p, 0.0, 1.0);
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE, p, 0.0, 1.0);
         } else if (p == 1.0) {
             ret = Double.POSITIVE_INFINITY;
         } else {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.special.Beta;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Default implementation of
@@ -38,10 +39,6 @@ public class FDistributionImpl
      */
     public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
 
-    /** Message for non positive degrees of freddom. */
-    private static final String NON_POSITIVE_DEGREES_OF_FREEDOM_MESSAGE =
-        "degrees of freedom must be positive ({0})";
-
     /** Serializable version identifier */
     private static final long serialVersionUID = -8516354193418641566L;
 
@@ -222,7 +219,7 @@ public class FDistributionImpl
     private void setNumeratorDegreesOfFreedomInternal(double degreesOfFreedom) {
         if (degreesOfFreedom <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  NON_POSITIVE_DEGREES_OF_FREEDOM_MESSAGE, degreesOfFreedom);
+                  LocalizedFormats.NOT_POSITIVE_DEGREES_OF_FREEDOM, degreesOfFreedom);
         }
         this.numeratorDegreesOfFreedom = degreesOfFreedom;
     }
@@ -256,7 +253,7 @@ public class FDistributionImpl
     private void setDenominatorDegreesOfFreedomInternal(double degreesOfFreedom) {
         if (degreesOfFreedom <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  NON_POSITIVE_DEGREES_OF_FREEDOM_MESSAGE, degreesOfFreedom);
+                  LocalizedFormats.NOT_POSITIVE_DEGREES_OF_FREEDOM, degreesOfFreedom);
         }
         this.denominatorDegreesOfFreedom = degreesOfFreedom;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.special.Gamma;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * The default implementation of {@link GammaDistribution}.
@@ -145,7 +146,7 @@ public class GammaDistributionImpl exten
     private void setAlphaInternal(double newAlpha) {
         if (newAlpha <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "alpha must be positive ({0})",
+                  LocalizedFormats.NOT_POSITIVE_ALPHA,
                   newAlpha);
         }
         this.alpha = newAlpha;
@@ -178,7 +179,7 @@ public class GammaDistributionImpl exten
     private void setBetaInternal(double newBeta) {
         if (newBeta <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "beta must be positive ({0})",
+                  LocalizedFormats.NOT_POSITIVE_BETA,
                   newBeta);
         }
         this.beta = newBeta;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.distribu
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -56,13 +57,13 @@ public class HypergeometricDistributionI
         if (numberOfSuccesses > populationSize) {
             throw MathRuntimeException
                     .createIllegalArgumentException(
-                            "number of successes ({0}) must be less than or equal to population size ({1})",
+                            LocalizedFormats.NUMBER_OF_SUCCESS_LARGER_THAN_POPULATION_SIZE,
                             numberOfSuccesses, populationSize);
         }
         if (sampleSize > populationSize) {
             throw MathRuntimeException
                     .createIllegalArgumentException(
-                            "sample size ({0}) must be less than or equal to population size ({1})",
+                            LocalizedFormats.SAMPLE_SIZE_LARGER_THAN_POPULATION_SIZE,
                             sampleSize, populationSize);
         }
 
@@ -249,7 +250,7 @@ public class HypergeometricDistributionI
     private void setNumberOfSuccessesInternal(int num) {
         if (num < 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "number of successes must be non-negative ({0})", num);
+                    LocalizedFormats.NEGATIVE_NUMBER_OF_SUCCESSES, num);
         }
         numberOfSuccesses = num;
     }
@@ -274,7 +275,7 @@ public class HypergeometricDistributionI
     private void setPopulationSizeInternal(int size) {
         if (size <= 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "population size must be positive ({0})", size);
+                    LocalizedFormats.NOT_POSITIVE_POPULATION_SIZE, size);
         }
         populationSize = size;
     }
@@ -299,7 +300,7 @@ public class HypergeometricDistributionI
     private void setSampleSizeInternal(int size) {
         if (size < 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "sample size must be positive ({0})", size);
+                    LocalizedFormats.NOT_POSITIVE_SAMPLE_SIZE, size);
         }
         sampleSize = size;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/NormalDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -23,6 +23,7 @@ import org.apache.commons.math.MathExcep
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.special.Erf;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Default implementation of
@@ -138,7 +139,7 @@ public class NormalDistributionImpl exte
     private void setStandardDeviationInternal(double sd) {
         if (sd <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "standard deviation must be positive ({0})",
+                  LocalizedFormats.NOT_POSITIVE_STANDARD_DEVIATION,
                   sd);
         }
         standardDeviation = sd;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/PascalDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/PascalDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/PascalDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/PascalDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.special.Beta;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -88,7 +89,7 @@ public class PascalDistributionImpl exte
     private void setNumberOfSuccessesInternal(int successes) {
         if (successes < 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "number of successes must be non-negative ({0})",
+                  LocalizedFormats.NEGATIVE_NUMBER_OF_SUCCESSES,
                   successes);
         }
         numberOfSuccesses = successes;
@@ -114,7 +115,7 @@ public class PascalDistributionImpl exte
     private void setProbabilityOfSuccessInternal(double p) {
         if (p < 0.0 || p > 1.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "{0} out of [{1}, {2}] range", p, 0.0, 1.0);
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE, p, 0.0, 1.0);
         }
         probabilityOfSuccess = p;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.special.Gamma;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -168,7 +169,7 @@ public class PoissonDistributionImpl ext
                                           double p) {
         if (p <= 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "the Poisson mean must be positive ({0})", p);
+                    LocalizedFormats.NOT_POSITIVE_POISSON_MEAN, p);
         }
         mean = p;
         normal = z;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/TDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/TDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/TDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/TDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import org.apache.commons.math.MathExcep
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.special.Beta;
 import org.apache.commons.math.special.Gamma;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Default implementation of
@@ -87,7 +88,7 @@ public class TDistributionImpl
     private void setDegreesOfFreedomInternal(double newDegreesOfFreedom) {
         if (newDegreesOfFreedom <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "degrees of freedom must be positive ({0})",
+                  LocalizedFormats.NOT_POSITIVE_DEGREES_OF_FREEDOM,
                   newDegreesOfFreedom);
         }
         this.degreesOfFreedom = newDegreesOfFreedom;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.distribu
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Default implementation of
@@ -149,7 +150,7 @@ public class WeibullDistributionImpl ext
         double ret;
         if (p < 0.0 || p > 1.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "{0} out of [{1}, {2}] range", p, 0.0, 1.0);
+                  LocalizedFormats.OUT_OF_RANGE_SIMPLE, p, 0.0, 1.0);
         } else if (p == 0) {
             ret = 0.0;
         } else  if (p == 1) {
@@ -176,7 +177,7 @@ public class WeibullDistributionImpl ext
     private void setShapeInternal(double alpha) {
         if (alpha <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "shape must be positive ({0})",
+                  LocalizedFormats.NOT_POSITIVE_SHAPE,
                   alpha);
         }
         this.shape = alpha;
@@ -198,7 +199,7 @@ public class WeibullDistributionImpl ext
     private void setScaleInternal(double beta) {
         if (beta <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "scale must be positive ({0})",
+                  LocalizedFormats.NOT_POSITIVE_SCALE,
                   beta);
         }
         this.scale = beta;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ZipfDistributionImpl.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.distribu
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implementation for the {@link ZipfDistribution}.
@@ -87,8 +88,7 @@ public class ZipfDistributionImpl extend
         throws IllegalArgumentException {
         if (n <= 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid number of elements {0} (must be positive)",
-                    n);
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, n, 0);
         }
         this.numberOfElements = n;
     }
@@ -127,7 +127,7 @@ public class ZipfDistributionImpl extend
         throws IllegalArgumentException {
         if (s <= 0.0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid exponent {0} (must be positive)",
+                    LocalizedFormats.NOT_POSITIVE_EXPONENT,
                     s);
         }
         this.exponent = s;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/AbstractEstimator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/AbstractEstimator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/AbstractEstimator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/AbstractEstimator.java Wed Jun 16 23:03:38 2010
@@ -23,6 +23,7 @@ import org.apache.commons.math.linear.In
 import org.apache.commons.math.linear.LUDecompositionImpl;
 import org.apache.commons.math.linear.MatrixUtils;
 import org.apache.commons.math.linear.RealMatrix;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Base class for implementing estimators.
@@ -150,7 +151,7 @@ public abstract class AbstractEstimator 
     throws EstimationException {
 
         if (++costEvaluations > maxCostEval) {
-            throw new EstimationException("maximal number of evaluations exceeded ({0})",
+            throw new EstimationException(LocalizedFormats.MAX_EVALUATIONS_EXCEEDED,
                                           maxCostEval);
         }
 
@@ -237,7 +238,7 @@ public abstract class AbstractEstimator 
                 new LUDecompositionImpl(MatrixUtils.createRealMatrix(jTj)).getSolver().getInverse();
             return inverse.getData();
         } catch (InvalidMatrixException ime) {
-            throw new EstimationException("unable to compute covariances: singular problem");
+            throw new EstimationException(LocalizedFormats.UNABLE_TO_COMPUTE_COVARIANCE_SINGULAR_PROBLEM);
         }
 
     }
@@ -257,7 +258,7 @@ public abstract class AbstractEstimator 
         int p = problem.getUnboundParameters().length;
         if (m <= p) {
             throw new EstimationException(
-                    "no degrees of freedom ({0} measurements, {1} parameters)",
+                    LocalizedFormats.NO_DEGREES_OF_FREEDOM,
                     m, p);
         }
         double[] errors = new double[problem.getUnboundParameters().length];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/EstimationException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/EstimationException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/EstimationException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/EstimationException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,8 @@
 package org.apache.commons.math.estimation;
 
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.DummyLocalizable;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * This class represents exceptions thrown by the estimation solvers.
@@ -42,6 +44,16 @@ extends MathException {
      * @param parts to insert in the format (no translation)
      */
     public EstimationException(String specifier, Object ... parts) {
+        this(new DummyLocalizable(specifier), parts);
+    }
+
+    /**
+     * Simple constructor.
+     * Build an exception by translating and formating a message
+     * @param specifier format specifier (to be translated)
+     * @param parts to insert in the format (no translation)
+     */
+    public EstimationException(Localizable specifier, Object ... parts) {
         super(specifier, parts);
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java Wed Jun 16 23:03:38 2010
@@ -25,6 +25,7 @@ import org.apache.commons.math.linear.Ma
 import org.apache.commons.math.linear.RealMatrix;
 import org.apache.commons.math.linear.RealVector;
 import org.apache.commons.math.linear.ArrayRealVector;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class implements a solver for estimation problems.
@@ -213,7 +214,7 @@ public class GaussNewtonEstimator extend
                 }
 
             } catch(InvalidMatrixException e) {
-                throw new EstimationException("unable to solve: singular problem");
+                throw new EstimationException(LocalizedFormats.UNABLE_TO_SOLVE_SINGULAR_PROBLEM);
             }
 
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/estimation/LevenbergMarquardtEstimator.java Wed Jun 16 23:03:38 2010
@@ -19,6 +19,8 @@ package org.apache.commons.math.estimati
 import java.io.Serializable;
 import java.util.Arrays;
 
+import org.apache.commons.math.util.LocalizedFormats;
+
 
 /**
  * This class solves a least squares problem.
@@ -821,7 +823,7 @@ public class LevenbergMarquardtEstimator
         }
         if (Double.isInfinite(norm2) || Double.isNaN(norm2)) {
             throw new EstimationException(
-                    "unable to perform Q.R decomposition on the {0}x{1} jacobian matrix",
+                    LocalizedFormats.UNABLE_TO_PERFORM_QR_DECOMPOSITION_ON_JACOBIAN,
                     rows, cols);
         }
         if (norm2 > ak2) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/AbstractFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/AbstractFormat.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/AbstractFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/AbstractFormat.java Wed Jun 16 23:03:38 2010
@@ -24,6 +24,7 @@ import java.text.ParsePosition;
 import java.util.Locale;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Common part shared by both {@link FractionFormat} and {@link BigFractionFormat}.
@@ -119,7 +120,7 @@ public abstract class AbstractFormat ext
     public void setDenominatorFormat(final NumberFormat format) {
         if (format == null) {
             throw MathRuntimeException.createIllegalArgumentException(
-                "denominator format can not be null");
+                LocalizedFormats.NULL_DENOMINATOR_FORMAT);
         }
         this.denominatorFormat = format;
     }
@@ -133,7 +134,7 @@ public abstract class AbstractFormat ext
     public void setNumeratorFormat(final NumberFormat format) {
         if (format == null) {
             throw MathRuntimeException.createIllegalArgumentException(
-                "numerator format can not be null");
+                LocalizedFormats.NULL_NUMERATOR_FORMAT);
         }
         this.numeratorFormat = format;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFraction.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import java.math.BigInteger;
 
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -80,10 +81,6 @@ public class BigFraction
     /** Serializable version identifier. */
     private static final long serialVersionUID = -5630213147331578515L;
 
-    /** Message for zero denominator. */
-    private static final String FORBIDDEN_ZERO_DENOMINATOR =
-        "denominator must be different from 0";
-
     /** <code>BigInteger</code> representation of 100. */
     private static final BigInteger ONE_HUNDRED_DOUBLE = BigInteger.valueOf(100);
 
@@ -123,13 +120,13 @@ public class BigFraction
      */
     public BigFraction(BigInteger num, BigInteger den) {
         if (num == null) {
-            throw MathRuntimeException.createNullPointerException("numerator is null");
+            throw MathRuntimeException.createNullPointerException(LocalizedFormats.NULL_NUMERATOR);
         }
         if (den == null) {
-            throw MathRuntimeException.createNullPointerException("denominator is null");
+            throw MathRuntimeException.createNullPointerException(LocalizedFormats.NULL_DENOMINATOR);
         }
         if (BigInteger.ZERO.equals(den)) {
-            throw MathRuntimeException.createArithmeticException(FORBIDDEN_ZERO_DENOMINATOR);
+            throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
         }
         if (BigInteger.ZERO.equals(num)) {
             numerator   = BigInteger.ZERO;
@@ -179,10 +176,10 @@ public class BigFraction
      */
     public BigFraction(final double value) throws IllegalArgumentException {
         if (Double.isNaN(value)) {
-            throw MathRuntimeException.createIllegalArgumentException("cannot convert NaN value");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NAN_VALUE_CONVERSION);
         }
         if (Double.isInfinite(value)) {
-            throw MathRuntimeException.createIllegalArgumentException("cannot convert infinite value");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.INFINITE_VALUE_CONVERSION);
         }
 
         // compute m and k such that value = m * 2^k
@@ -619,7 +616,7 @@ public class BigFraction
      */
     public BigFraction divide(final BigInteger bg) {
         if (BigInteger.ZERO.equals(bg)) {
-            throw MathRuntimeException.createArithmeticException(FORBIDDEN_ZERO_DENOMINATOR);
+            throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
         }
         return new BigFraction(numerator, denominator.multiply(bg));
     }
@@ -672,7 +669,7 @@ public class BigFraction
      */
     public BigFraction divide(final BigFraction fraction) {
         if (BigInteger.ZERO.equals(fraction.numerator)) {
-            throw MathRuntimeException.createArithmeticException(FORBIDDEN_ZERO_DENOMINATOR);
+            throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
         }
 
         return multiply(fraction.reciprocal());

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFractionFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFractionFormat.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFractionFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/BigFractionFormat.java Wed Jun 16 23:03:38 2010
@@ -26,6 +26,7 @@ import java.text.ParsePosition;
 import java.util.Locale;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Formats a BigFraction number in proper format or improper format.
@@ -174,7 +175,7 @@ public class BigFractionFormat extends A
                          toAppendTo, pos);
         } else {
             throw MathRuntimeException.createIllegalArgumentException(
-                "cannot format given object as a fraction number");
+                LocalizedFormats.CANNOT_FORMAT_OBJECT_TO_FRACTION);
         }
 
         return ret;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/Fraction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/Fraction.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/Fraction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/Fraction.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.math.BigInteger;
 
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -77,18 +78,6 @@ public class Fraction
     /** A fraction representing "-1 / 1". */
     public static final Fraction MINUS_ONE = new Fraction(-1, 1);
 
-    /** Message for zero denominator. */
-    private static final String ZERO_DENOMINATOR_MESSAGE =
-        "zero denominator in fraction {0}/{1}";
-
-    /** Message for overflow. */
-    private static final String OVERFLOW_MESSAGE =
-        "overflow in fraction {0}/{1}, cannot negate";
-
-    /** Message for null fraction. */
-    private static final String NULL_FRACTION =
-        "null fraction";
-
     /** Serializable version identifier */
     private static final long serialVersionUID = 3698073679419233275L;
 
@@ -265,12 +254,12 @@ public class Fraction
     public Fraction(int num, int den) {
         if (den == 0) {
             throw MathRuntimeException.createArithmeticException(
-                  ZERO_DENOMINATOR_MESSAGE, num, den);
+                  LocalizedFormats.ZERO_DENOMINATOR_IN_FRACTION, num, den);
         }
         if (den < 0) {
             if (num == Integer.MIN_VALUE || den == Integer.MIN_VALUE) {
                 throw MathRuntimeException.createArithmeticException(
-                      OVERFLOW_MESSAGE, num, den);
+                      LocalizedFormats.OVERFLOW_IN_FRACTION, num, den);
             }
             num = -num;
             den = -den;
@@ -413,7 +402,7 @@ public class Fraction
     public Fraction negate() {
         if (numerator==Integer.MIN_VALUE) {
             throw MathRuntimeException.createArithmeticException(
-                  OVERFLOW_MESSAGE, numerator, denominator);
+                  LocalizedFormats.OVERFLOW_IN_FRACTION, numerator, denominator);
         }
         return new Fraction(-numerator, denominator);
     }
@@ -484,7 +473,7 @@ public class Fraction
      */
     private Fraction addSub(Fraction fraction, boolean isAdd) {
         if (fraction == null) {
-            throw MathRuntimeException.createIllegalArgumentException(NULL_FRACTION);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NULL_FRACTION);
         }
         // zero is identity for addition.
         if (numerator == 0) {
@@ -521,7 +510,7 @@ public class Fraction
         // result is (t/d2) / (u'/d1)(v'/d2)
         BigInteger w = t.divide(BigInteger.valueOf(d2));
         if (w.bitLength() > 31) {
-            throw MathRuntimeException.createArithmeticException("overflow, numerator too large after multiply: {0}",
+            throw MathRuntimeException.createArithmeticException(LocalizedFormats.NUMERATOR_OVERFLOW_AFTER_MULTIPLY,
                                                                  w);
         }
         return new Fraction (w.intValue(),
@@ -541,7 +530,7 @@ public class Fraction
      */
     public Fraction multiply(Fraction fraction) {
         if (fraction == null) {
-            throw MathRuntimeException.createIllegalArgumentException(NULL_FRACTION);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NULL_FRACTION);
         }
         if (numerator == 0 || fraction.numerator == 0) {
             return ZERO;
@@ -576,11 +565,11 @@ public class Fraction
      */
     public Fraction divide(Fraction fraction) {
         if (fraction == null) {
-            throw MathRuntimeException.createIllegalArgumentException(NULL_FRACTION);
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.NULL_FRACTION);
         }
         if (fraction.numerator == 0) {
             throw MathRuntimeException.createArithmeticException(
-                    "the fraction to divide by must not be zero: {0}/{1}",
+                    LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
                     fraction.numerator, fraction.denominator);
         }
         return multiply(fraction.reciprocal());
@@ -609,7 +598,7 @@ public class Fraction
     public static Fraction getReducedFraction(int numerator, int denominator) {
         if (denominator == 0) {
             throw MathRuntimeException.createArithmeticException(
-                  ZERO_DENOMINATOR_MESSAGE, numerator, denominator);
+                  LocalizedFormats.ZERO_DENOMINATOR_IN_FRACTION, numerator, denominator);
         }
         if (numerator==0) {
             return ZERO; // normalize zero.
@@ -622,7 +611,7 @@ public class Fraction
             if (numerator==Integer.MIN_VALUE ||
                     denominator==Integer.MIN_VALUE) {
                 throw MathRuntimeException.createArithmeticException(
-                      OVERFLOW_MESSAGE, numerator, denominator);
+                      LocalizedFormats.OVERFLOW_IN_FRACTION, numerator, denominator);
             }
             numerator = -numerator;
             denominator = -denominator;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionConversionException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.fraction;
 
 import org.apache.commons.math.ConvergenceException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Error thrown when a double value cannot be converted to a fraction
@@ -38,7 +39,7 @@ public class FractionConversionException
      * @param maxIterations maximal number of iterations allowed
      */
     public FractionConversionException(double value, int maxIterations) {
-        super("Unable to convert {0} to fraction after {1} iterations", value, maxIterations);
+        super(LocalizedFormats.FAILED_FRACTION_CONVERSION, value, maxIterations);
     }
 
     /**
@@ -49,7 +50,7 @@ public class FractionConversionException
      * @param q current denominator
      */
     public FractionConversionException(double value, long p, long q) {
-        super("Overflow trying to convert {0} to fraction ({1}/{2})", value, p, q);
+        super(LocalizedFormats.FRACTION_CONVERSION_OVERFLOW, value, p, q);
     }
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/FractionFormat.java Wed Jun 16 23:03:38 2010
@@ -25,6 +25,7 @@ import java.util.Locale;
 
 import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Formats a Fraction number in proper format or improper format.  The number
@@ -180,12 +181,12 @@ public class FractionFormat extends Abst
                              toAppendTo, pos);
             } catch (ConvergenceException ex) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                    "cannot convert given object to a fraction number: {0}",
+                    LocalizedFormats.CANNOT_CONVERT_OBJECT_TO_FRACTION,
                     ex.getLocalizedMessage());
             }
         } else {
             throw MathRuntimeException.createIllegalArgumentException(
-                "cannot format given object as a fraction number");
+                LocalizedFormats.CANNOT_FORMAT_OBJECT_TO_FRACTION);
         }
 
         return ret;



Mime
View raw message