commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r955423 [3/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/fraction/ProperBigFractionFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/ProperBigFractionFormat.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/ProperBigFractionFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/ProperBigFractionFormat.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import java.text.NumberFormat;
 import java.text.ParsePosition;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Formats a BigFraction number in proper format.  The number format for each of
@@ -233,7 +234,7 @@ public class ProperBigFractionFormat ext
     public void setWholeFormat(final NumberFormat format) {
         if (format == null) {
             throw MathRuntimeException.createIllegalArgumentException(
-                "whole format can not be null");
+                LocalizedFormats.NULL_WHOLE_FORMAT);
         }
         this.wholeFormat = format;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/ProperFractionFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/ProperFractionFormat.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/ProperFractionFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/fraction/ProperFractionFormat.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.text.NumberFormat;
 import java.text.ParsePosition;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -226,7 +227,7 @@ public class ProperFractionFormat extend
     public void setWholeFormat(NumberFormat format) {
         if (format == null) {
             throw MathRuntimeException.createIllegalArgumentException(
-                "whole format can not be null");
+                LocalizedFormats.NULL_WHOLE_FORMAT);
         }
         this.wholeFormat = format;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/CardanEulerSingularityException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.geometry;
 
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /** This class represents exceptions thrown while extractiong Cardan
  * or Euler angles from a rotation.
@@ -38,7 +39,7 @@ public class CardanEulerSingularityExcep
      * if false it is related to EulerAngles
      */
     public CardanEulerSingularityException(boolean isCardan) {
-        super(isCardan ? "Cardan angles singularity" : "Euler angles singularity");
+        super(isCardan ? LocalizedFormats.CARDAN_ANGLES_SINGULARITY : LocalizedFormats.EULER_ANGLES_SINGULARITY);
     }
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/NotARotationMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/NotARotationMatrixException.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/NotARotationMatrixException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/NotARotationMatrixException.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.geometry;
 
 import org.apache.commons.math.MathException;
+import org.apache.commons.math.util.Localizable;
 
 /**
  * This class represents exceptions thrown while building rotations
@@ -38,9 +39,22 @@ public class NotARotationMatrixException
      * 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)
+     * @deprecated as of 2.2 replaced by {@link #NotARotationMatrixException(Localizable, Object...)}
      */
+    @Deprecated
     public NotARotationMatrixException(String specifier, Object ... parts) {
         super(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)
+     * @since 2.2
+     */
+    public NotARotationMatrixException(Localizable specifier, Object ... parts) {
+        super(specifier, parts);
+    }
+
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Rotation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Rotation.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Rotation.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Rotation.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.geometry
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class implements rotations in a three-dimensional space.
@@ -172,7 +173,7 @@ public class Rotation implements Seriali
 
     double norm = axis.getNorm();
     if (norm == 0) {
-      throw MathRuntimeException.createArithmeticException("zero norm for rotation axis");
+      throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS);
     }
 
     double halfAngle = -0.5 * angle;
@@ -222,7 +223,7 @@ public class Rotation implements Seriali
     if ((m.length != 3) || (m[0].length != 3) ||
         (m[1].length != 3) || (m[2].length != 3)) {
       throw new NotARotationMatrixException(
-              "a {0}x{1} matrix cannot be a rotation matrix",
+              LocalizedFormats.ROTATION_MATRIX_DIMENSIONS,
               m.length, m[0].length);
     }
 
@@ -235,7 +236,7 @@ public class Rotation implements Seriali
                  ort[2][0] * (ort[0][1] * ort[1][2] - ort[1][1] * ort[0][2]);
     if (det < 0.0) {
       throw new NotARotationMatrixException(
-              "the closest orthogonal matrix has a negative determinant {0}",
+              LocalizedFormats.CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT,
               det);
     }
 
@@ -316,7 +317,7 @@ public class Rotation implements Seriali
   double v1v1 = Vector3D.dotProduct(v1, v1);
   double v2v2 = Vector3D.dotProduct(v2, v2);
   if ((u1u1 == 0) || (u2u2 == 0) || (v1v1 == 0) || (v2v2 == 0)) {
-    throw MathRuntimeException.createIllegalArgumentException("zero norm for rotation defining vector");
+    throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
   }
 
   double u1x = u1.getX();
@@ -447,7 +448,7 @@ public class Rotation implements Seriali
 
     double normProduct = u.getNorm() * v.getNorm();
     if (normProduct == 0) {
-        throw MathRuntimeException.createIllegalArgumentException("zero norm for rotation defining vector");
+        throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
     }
 
     double dot = Vector3D.dotProduct(u, v);
@@ -1035,7 +1036,7 @@ public class Rotation implements Seriali
 
     // the algorithm did not converge after 10 iterations
     throw new NotARotationMatrixException(
-            "unable to orthogonalize matrix in {0} iterations",
+            LocalizedFormats.UNABLE_TO_ORTHOGONOLIZE_MATRIX,
             i - 1);
   }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Vector3D.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Vector3D.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Vector3D.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Vector3D.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.geometry
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -283,7 +284,7 @@ public class Vector3D
   public Vector3D normalize() {
     double s = getNorm();
     if (s == 0) {
-      throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");
+      throw MathRuntimeException.createArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
     }
     return scalarMultiply(1 / s);
   }
@@ -307,7 +308,7 @@ public class Vector3D
 
     double threshold = 0.6 * getNorm();
     if (threshold == 0) {
-      throw MathRuntimeException.createArithmeticException("zero norm");
+      throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_NORM);
     }
 
     if ((x >= -threshold) && (x <= threshold)) {
@@ -337,7 +338,7 @@ public class Vector3D
 
     double normProduct = v1.getNorm() * v2.getNorm();
     if (normProduct == 0) {
-      throw MathRuntimeException.createArithmeticException("zero norm");
+      throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_NORM);
     }
 
     double dot = dotProduct(v1, v2);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Vector3DFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Vector3DFormat.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Vector3DFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/Vector3DFormat.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 3D vector in components list format "{x; y; z}".
@@ -241,7 +242,7 @@ public class Vector3DFormat extends Comp
             return format( (Vector3D)obj, toAppendTo, pos);
         }
 
-        throw MathRuntimeException.createIllegalArgumentException("cannot format a {0} instance as a 3D vector",
+        throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.CANNOT_FORMAT_INSTANCE_AS_3D_VECTOR,
                                                                   obj.getClass().getName());
 
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java Wed Jun 16 23:03:38 2010
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Basic implementation of {@link FieldMatrix} methods regardless of the underlying storage.
@@ -64,15 +65,13 @@ public abstract class AbstractFieldMatri
     protected AbstractFieldMatrix(final Field<T> field,
                                   final int rowDimension, final int columnDimension)
         throws IllegalArgumentException {
-        if (rowDimension <= 0 ) {
+        if (rowDimension < 1 ) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid row dimension {0} (must be positive)",
-                    rowDimension);
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, rowDimension, 1);
         }
-        if (columnDimension <= 0) {
+        if (columnDimension < 1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid column dimension {0} (must be positive)",
-                    columnDimension);
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, columnDimension, 1);
         }
         this.field = field;
     }
@@ -87,10 +86,10 @@ public abstract class AbstractFieldMatri
     protected static <T extends FieldElement<T>> Field<T> extractField(final T[][] d)
         throws IllegalArgumentException {
         if (d.length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
         if (d[0].length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         return d[0][0].getField();
     }
@@ -105,7 +104,7 @@ public abstract class AbstractFieldMatri
     protected static <T extends FieldElement<T>> Field<T> extractField(final T[] d)
         throws IllegalArgumentException {
         if (d.length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
         return d[0].getField();
     }
@@ -338,7 +337,7 @@ public abstract class AbstractFieldMatri
         final int columnsCount = endColumn + 1 - startColumn;
         if ((destination.length < rowsCount) || (destination[0].length < columnsCount)) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     destination.length, destination[0].length,
                     rowsCount, columnsCount);
         }
@@ -380,7 +379,7 @@ public abstract class AbstractFieldMatri
         if ((destination.length < selectedRows.length) ||
             (destination[0].length < selectedColumns.length)) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     destination.length, destination[0].length,
                     selectedRows.length, selectedColumns.length);
         }
@@ -401,18 +400,18 @@ public abstract class AbstractFieldMatri
 
         final int nRows = subMatrix.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
 
         final int nCols = subMatrix[0].length;
         if (nCols == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
 
         for (int r = 1; r < nRows; ++r) {
             if (subMatrix[r].length != nCols) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "some rows have length {0} while others have length {1}",
+                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                         nCols, subMatrix[r].length);
             }
         }
@@ -454,7 +453,7 @@ public abstract class AbstractFieldMatri
         if ((matrix.getRowDimension() != 1) ||
             (matrix.getColumnDimension() != nCols)) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     matrix.getRowDimension(), matrix.getColumnDimension(), 1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
@@ -487,7 +486,7 @@ public abstract class AbstractFieldMatri
         if ((matrix.getRowDimension() != nRows) ||
             (matrix.getColumnDimension() != 1)) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     matrix.getRowDimension(), matrix.getColumnDimension(), nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
@@ -510,7 +509,7 @@ public abstract class AbstractFieldMatri
         final int nCols = getColumnDimension();
         if (vector.getDimension() != nCols) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     1, vector.getDimension(), 1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
@@ -533,7 +532,7 @@ public abstract class AbstractFieldMatri
         final int nRows = getRowDimension();
         if (vector.getDimension() != nRows) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     vector.getDimension(), 1, nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
@@ -565,7 +564,7 @@ public abstract class AbstractFieldMatri
         final int nCols = getColumnDimension();
         if (array.length != nCols) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     1, array.length, 1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
@@ -597,7 +596,7 @@ public abstract class AbstractFieldMatri
         final int nRows = getRowDimension();
         if (array.length != nRows) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     array.length, 1, nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
@@ -676,7 +675,7 @@ public abstract class AbstractFieldMatri
         final int nCols = getColumnDimension();
         if (v.length != nCols) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, nCols);
         }
 
@@ -703,7 +702,7 @@ public abstract class AbstractFieldMatri
             final int nCols = getColumnDimension();
             if (v.getDimension() != nCols) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}",
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                         v.getDimension(), nCols);
             }
 
@@ -728,7 +727,7 @@ public abstract class AbstractFieldMatri
         final int nCols = getColumnDimension();
         if (v.length != nRows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, nRows);
         }
 
@@ -756,7 +755,7 @@ public abstract class AbstractFieldMatri
             final int nCols = getColumnDimension();
             if (v.getDimension() != nRows) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}",
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                         v.getDimension(), nRows);
             }
 
@@ -1054,14 +1053,14 @@ public abstract class AbstractFieldMatri
         checkRowIndex(startRow);
         checkRowIndex(endRow);
         if (startRow > endRow) {
-            throw new MatrixIndexException("initial row {0} after final row {1}",
+            throw new MatrixIndexException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            startRow, endRow);
         }
 
         checkColumnIndex(startColumn);
         checkColumnIndex(endColumn);
         if (startColumn > endColumn) {
-            throw new MatrixIndexException("initial column {0} after final column {1}",
+            throw new MatrixIndexException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN,
                                            startColumn, endColumn);
         }
 
@@ -1079,9 +1078,9 @@ public abstract class AbstractFieldMatri
     protected void checkSubMatrixIndex(final int[] selectedRows, final int[] selectedColumns) {
         if (selectedRows.length * selectedColumns.length == 0) {
             if (selectedRows.length == 0) {
-                throw new MatrixIndexException("empty selected row index array");
+                throw new MatrixIndexException(LocalizedFormats.EMPTY_SELECTED_ROW_INDEX_ARRAY);
             }
-            throw new MatrixIndexException("empty selected column index array");
+            throw new MatrixIndexException(LocalizedFormats.EMPTY_SELECTED_COLUMN_INDEX_ARRAY);
         }
 
         for (final int row : selectedRows) {
@@ -1101,7 +1100,7 @@ public abstract class AbstractFieldMatri
         if ((getRowDimension()    != m.getRowDimension()) ||
             (getColumnDimension() != m.getColumnDimension())) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "{0}x{1} and {2}x{3} matrices are not addition compatible",
+                    LocalizedFormats.NOT_ADDITION_COMPATIBLE_MATRICES,
                     getRowDimension(), getColumnDimension(),
                     m.getRowDimension(), m.getColumnDimension());
         }
@@ -1116,7 +1115,7 @@ public abstract class AbstractFieldMatri
         if ((getRowDimension()    != m.getRowDimension()) ||
             (getColumnDimension() != m.getColumnDimension())) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "{0}x{1} and {2}x{3} matrices are not subtraction compatible",
+                    LocalizedFormats.NOT_SUBTRACTION_COMPATIBLE_MATRICES,
                     getRowDimension(), getColumnDimension(),
                     m.getRowDimension(), m.getColumnDimension());
         }
@@ -1130,7 +1129,7 @@ public abstract class AbstractFieldMatri
     protected void checkMultiplicationCompatible(final FieldMatrix<T> m) {
         if (getColumnDimension() != m.getRowDimension()) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "{0}x{1} and {2}x{3} matrices are not multiplication compatible",
+                    LocalizedFormats.NOT_MULTIPLICATION_COMPATIBLE_MATRICES,
                     getRowDimension(), getColumnDimension(),
                     m.getRowDimension(), m.getColumnDimension());
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -53,15 +54,13 @@ public abstract class AbstractRealMatrix
      */
     protected AbstractRealMatrix(final int rowDimension, final int columnDimension)
         throws IllegalArgumentException {
-        if (rowDimension <= 0 ) {
+        if (rowDimension < 1 ) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid row dimension {0} (must be positive)",
-                    rowDimension);
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, rowDimension, 1);
         }
         if (columnDimension <= 0) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid column dimension {0} (must be positive)",
-                    columnDimension);
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, columnDimension, 1);
         }
         lu = null;
     }
@@ -311,7 +310,7 @@ public abstract class AbstractRealMatrix
         final int columnsCount = endColumn + 1 - startColumn;
         if ((destination.length < rowsCount) || (destination[0].length < columnsCount)) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     destination.length, destination[0].length,
                     rowsCount, columnsCount);
         }
@@ -353,7 +352,7 @@ public abstract class AbstractRealMatrix
         if ((destination.length < selectedRows.length) ||
             (destination[0].length < selectedColumns.length)) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     destination.length, destination[0].length,
                     selectedRows.length, selectedColumns.length);
         }
@@ -374,18 +373,18 @@ public abstract class AbstractRealMatrix
 
         final int nRows = subMatrix.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
 
         final int nCols = subMatrix[0].length;
         if (nCols == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
 
         for (int r = 1; r < nRows; ++r) {
             if (subMatrix[r].length != nCols) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "some rows have length {0} while others have length {1}",
+                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                         nCols, subMatrix[r].length);
             }
         }
@@ -429,7 +428,7 @@ public abstract class AbstractRealMatrix
         if ((matrix.getRowDimension() != 1) ||
             (matrix.getColumnDimension() != nCols)) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     matrix.getRowDimension(), matrix.getColumnDimension(), 1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
@@ -462,7 +461,7 @@ public abstract class AbstractRealMatrix
         if ((matrix.getRowDimension() != nRows) ||
             (matrix.getColumnDimension() != 1)) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     matrix.getRowDimension(), matrix.getColumnDimension(), nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
@@ -485,7 +484,7 @@ public abstract class AbstractRealMatrix
         final int nCols = getColumnDimension();
         if (vector.getDimension() != nCols) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     1, vector.getDimension(), 1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
@@ -508,7 +507,7 @@ public abstract class AbstractRealMatrix
         final int nRows = getRowDimension();
         if (vector.getDimension() != nRows) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     vector.getDimension(), 1, nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
@@ -540,7 +539,7 @@ public abstract class AbstractRealMatrix
         final int nCols = getColumnDimension();
         if (array.length != nCols) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     1, array.length, 1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
@@ -572,7 +571,7 @@ public abstract class AbstractRealMatrix
         final int nRows = getRowDimension();
         if (array.length != nRows) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     array.length, 1, nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
@@ -677,7 +676,7 @@ public abstract class AbstractRealMatrix
         final int nCols = getColumnDimension();
         if (v.length != nCols) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, nCols);
         }
 
@@ -704,7 +703,7 @@ public abstract class AbstractRealMatrix
             final int nCols = getColumnDimension();
             if (v.getDimension() != nCols) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}",
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                         v.getDimension(), nCols);
             }
 
@@ -729,7 +728,7 @@ public abstract class AbstractRealMatrix
         final int nCols = getColumnDimension();
         if (v.length != nRows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, nRows);
         }
 
@@ -757,7 +756,7 @@ public abstract class AbstractRealMatrix
             final int nCols = getColumnDimension();
             if (v.getDimension() != nRows) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}",
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                         v.getDimension(), nRows);
             }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java Wed Jun 16 23:03:38 2010
@@ -25,6 +25,7 @@ import org.apache.commons.math.MathRunti
 import org.apache.commons.math.analysis.BinaryFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.ComposableFunction;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class provides default basic implementations for many methods in the
@@ -56,8 +57,7 @@ public abstract class AbstractRealVector
         double d = getDimension();
         if (d != n) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  "vector length mismatch: got {0} but expected {1}",
-                  d, n);
+                  LocalizedFormats.VECTOR_LENGTH_MISMATCH, d, n);
         }
     }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implementation of FieldMatrix<T> using a {@link FieldElement}[][] array to store entries.
@@ -39,26 +40,6 @@ public class Array2DRowFieldMatrix<T ext
     /** Serializable version identifier */
     private static final long serialVersionUID = 7260756672015356458L;
 
-    /** Message for at least one row. */
-    private static final String AT_LEAST_ONE_ROW_MESSAGE =
-        "matrix must have at least one row";
-
-    /** Message for at least one column. */
-    private static final String AT_LEAST_ONE_COLUMN_MESSAGE =
-        "matrix must have at least one column";
-
-    /** Message for different rows lengths. */
-    private static final String DIFFERENT_ROWS_LENGTHS_MESSAGE =
-        "some rows have length {0} while others have length {1}";
-
-    /** Message for no entry at selected indices. */
-    private static final String NO_ENTRY_MESSAGE =
-        "no entry at indices ({0}, {1}) in a {2}x{3} matrix";
-
-    /** Message for vector lengths mismatch. */
-    private static final String VECTOR_LENGTHS_MISMATCH =
-        "vector length mismatch: got {0} but expected {1}";
-
     /** Entries of the matrix */
     protected T[][] data;
 
@@ -132,17 +113,17 @@ public class Array2DRowFieldMatrix<T ext
             final int nRows = d.length;
             if (nRows == 0) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      AT_LEAST_ONE_ROW_MESSAGE);
+                      LocalizedFormats.AT_LEAST_ONE_ROW);
             }
             final int nCols = d[0].length;
             if (nCols == 0) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      AT_LEAST_ONE_COLUMN_MESSAGE);
+                      LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             for (int r = 1; r < nRows; r++) {
                 if (d[r].length != nCols) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                          DIFFERENT_ROWS_LENGTHS_MESSAGE, nCols, d[r].length);
+                          LocalizedFormats.DIFFERENT_ROWS_LENGTHS, nCols, d[r].length);
                 }
             }
             data = d;
@@ -327,28 +308,28 @@ public class Array2DRowFieldMatrix<T ext
         if (data == null) {
             if (row > 0) {
                 throw MathRuntimeException.createIllegalStateException(
-                      "first {0} rows are not initialized yet", row);
+                      LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
             }
             if (column > 0) {
                 throw MathRuntimeException.createIllegalStateException(
-                      "first {0} columns are not initialized yet", column);
+                      LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
             }
             final int nRows = subMatrix.length;
             if (nRows == 0) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      AT_LEAST_ONE_ROW_MESSAGE);
+                      LocalizedFormats.AT_LEAST_ONE_ROW);
             }
 
             final int nCols = subMatrix[0].length;
             if (nCols == 0) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      AT_LEAST_ONE_COLUMN_MESSAGE);
+                      LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             data = buildArray(getField(), subMatrix.length, nCols);
             for (int i = 0; i < data.length; ++i) {
                 if (subMatrix[i].length != nCols) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                          DIFFERENT_ROWS_LENGTHS_MESSAGE, nCols, subMatrix[i].length);
+                          LocalizedFormats.DIFFERENT_ROWS_LENGTHS, nCols, subMatrix[i].length);
                 }
                 System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
             }
@@ -366,7 +347,7 @@ public class Array2DRowFieldMatrix<T ext
             return data[row][column];
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                      NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());
+                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
         }
     }
 
@@ -378,7 +359,7 @@ public class Array2DRowFieldMatrix<T ext
             data[row][column] = value;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                      NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());
+                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
         }
     }
 
@@ -390,7 +371,7 @@ public class Array2DRowFieldMatrix<T ext
             data[row][column] = data[row][column].add(increment);
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                      NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());
+                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
         }
     }
 
@@ -402,7 +383,7 @@ public class Array2DRowFieldMatrix<T ext
             data[row][column] = data[row][column].multiply(factor);
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                      NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());
+                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
         }
     }
 
@@ -426,7 +407,7 @@ public class Array2DRowFieldMatrix<T ext
         final int nCols = this.getColumnDimension();
         if (v.length != nCols) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  VECTOR_LENGTHS_MISMATCH, v.length, nCols);
+                  LocalizedFormats.VECTOR_LENGTH_MISMATCH, v.length, nCols);
         }
         final T[] out = buildArray(getField(), nRows);
         for (int row = 0; row < nRows; row++) {
@@ -449,7 +430,7 @@ public class Array2DRowFieldMatrix<T ext
         final int nCols = getColumnDimension();
         if (v.length != nRows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  VECTOR_LENGTHS_MISMATCH, v.length, nRows);
+                  LocalizedFormats.VECTOR_LENGTH_MISMATCH, v.length, nRows);
         }
 
         final T[] out = buildArray(getField(), nCols);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.linear;
 import java.io.Serializable;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implementation of RealMatrix using a double[][] array to store entries and
@@ -54,26 +55,6 @@ public class Array2DRowRealMatrix extend
     /** Serializable version identifier */
     private static final long serialVersionUID = -1067294169172445528L;
 
-    /** Message for at least one row. */
-    private static final String AT_LEAST_ONE_ROW_MESSAGE =
-        "matrix must have at least one row";
-
-    /** Message for at least one column. */
-    private static final String AT_LEAST_ONE_COLUMN_MESSAGE =
-        "matrix must have at least one column";
-
-    /** Message for different rows lengths. */
-    private static final String DIFFERENT_ROWS_LENGTHS_MESSAGE =
-        "some rows have length {0} while others have length {1}";
-
-    /** Message for no entry at selected indices. */
-    private static final String NO_ENTRY_MESSAGE =
-        "no entry at indices ({0}, {1}) in a {2}x{3} matrix";
-
-    /** Message for vector lengths mismatch. */
-    private static final String VECTOR_LENGTHS_MISMATCH =
-        "vector length mismatch: got {0} but expected {1}";
-
     /** Entries of the matrix */
     protected double data[][];
 
@@ -141,17 +122,17 @@ public class Array2DRowRealMatrix extend
             final int nRows = d.length;
             if (nRows == 0) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      AT_LEAST_ONE_ROW_MESSAGE);
+                      LocalizedFormats.AT_LEAST_ONE_ROW);
             }
             final int nCols = d[0].length;
             if (nCols == 0) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      AT_LEAST_ONE_COLUMN_MESSAGE);
+                      LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             for (int r = 1; r < nRows; r++) {
                 if (d[r].length != nCols) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                          DIFFERENT_ROWS_LENGTHS_MESSAGE, nCols, d[r].length);
+                          LocalizedFormats.DIFFERENT_ROWS_LENGTHS, nCols, d[r].length);
                 }
             }
             data = d;
@@ -335,28 +316,28 @@ public class Array2DRowRealMatrix extend
         if (data == null) {
             if (row > 0) {
                 throw MathRuntimeException.createIllegalStateException(
-                      "first {0} rows are not initialized yet", row);
+                      LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
             }
             if (column > 0) {
                 throw MathRuntimeException.createIllegalStateException(
-                      "first {0} columns are not initialized yet", column);
+                      LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
             }
             final int nRows = subMatrix.length;
             if (nRows == 0) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      AT_LEAST_ONE_ROW_MESSAGE);
+                      LocalizedFormats.AT_LEAST_ONE_ROW);
             }
 
             final int nCols = subMatrix[0].length;
             if (nCols == 0) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      AT_LEAST_ONE_COLUMN_MESSAGE);
+                      LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             data = new double[subMatrix.length][nCols];
             for (int i = 0; i < data.length; ++i) {
                 if (subMatrix[i].length != nCols) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                          DIFFERENT_ROWS_LENGTHS_MESSAGE, nCols, subMatrix[i].length);
+                          LocalizedFormats.DIFFERENT_ROWS_LENGTHS, nCols, subMatrix[i].length);
                 }
                 System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
             }
@@ -374,7 +355,7 @@ public class Array2DRowRealMatrix extend
             return data[row][column];
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                      NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());
+                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
         }
     }
 
@@ -386,7 +367,7 @@ public class Array2DRowRealMatrix extend
             data[row][column] = value;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                      NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());
+                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
         }
     }
 
@@ -398,7 +379,7 @@ public class Array2DRowRealMatrix extend
             data[row][column] += increment;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                      NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());
+                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
         }
     }
 
@@ -410,7 +391,7 @@ public class Array2DRowRealMatrix extend
             data[row][column] *= factor;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                      NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension());
+                      LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
         }
     }
 
@@ -434,7 +415,7 @@ public class Array2DRowRealMatrix extend
         final int nCols = this.getColumnDimension();
         if (v.length != nCols) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  VECTOR_LENGTHS_MISMATCH, v.length, nCols);
+                  LocalizedFormats.VECTOR_LENGTH_MISMATCH, v.length, nCols);
         }
         final double[] out = new double[nRows];
         for (int row = 0; row < nRows; row++) {
@@ -457,7 +438,7 @@ public class Array2DRowRealMatrix extend
         final int nCols = getColumnDimension();
         if (v.length != nRows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  VECTOR_LENGTHS_MISMATCH, v.length, nRows);
+                  LocalizedFormats.VECTOR_LENGTH_MISMATCH, v.length, nRows);
         }
 
         final double[] out = new double[nCols];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayFieldVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayFieldVector.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayFieldVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayFieldVector.java Wed Jun 16 23:03:38 2010
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * This class implements the {@link FieldVector} interface with a {@link FieldElement} array.
@@ -88,7 +89,7 @@ public class ArrayFieldVector<T extends 
             data = d.clone();
         } catch (ArrayIndexOutOfBoundsException e) {
             throw MathRuntimeException.createIllegalArgumentException(
-                      "vector must have at least one element");
+                      LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
         }
     }
 
@@ -113,7 +114,7 @@ public class ArrayFieldVector<T extends 
             data = copyArray ? d.clone() :  d;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw MathRuntimeException.createIllegalArgumentException(
-                      "vector must have at least one element");
+                      LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
         }
     }
 
@@ -126,7 +127,7 @@ public class ArrayFieldVector<T extends 
     public ArrayFieldVector(T[] d, int pos, int size) {
         if (d.length < pos + size) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "position {0} and size {1} don't fit to the size of the input array {2}",
+                    LocalizedFormats.POSITION_SIZE_MISMATCH_INPUT_ARRAY,
                     pos, size, d.length);
         }
         field = d[0].getField();
@@ -215,7 +216,7 @@ public class ArrayFieldVector<T extends 
             field = data[0].getField();
         } catch (ArrayIndexOutOfBoundsException e) {
             throw MathRuntimeException.createIllegalArgumentException(
-                      "vector must have at least one element");
+                      LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
         }
     }
 
@@ -715,7 +716,7 @@ public class ArrayFieldVector<T extends 
         throws IllegalArgumentException {
         if (data.length != n) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     data.length, n);
         }
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.util.Arrays;
 import java.util.Iterator;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -30,10 +31,6 @@ import org.apache.commons.math.util.Math
  */
 public class ArrayRealVector extends AbstractRealVector implements Serializable {
 
-    /** Message for non fitting position and size. */
-    private static final String NON_FITTING_POSITION_AND_SIZE_MESSAGE =
-        "position {0} and size {1} don't fit to the size of the input array {2}";
-
     /** Serializable version identifier. */
     private static final long serialVersionUID = -1097961340710804027L;
 
@@ -103,7 +100,7 @@ public class ArrayRealVector extends Abs
             throw new NullPointerException();
         }
         if (d.length == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("vector must have at least one element");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
         }
         data = copyArray ? d.clone() :  d;
     }
@@ -117,7 +114,7 @@ public class ArrayRealVector extends Abs
     public ArrayRealVector(double[] d, int pos, int size) {
         if (d.length < pos + size) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  NON_FITTING_POSITION_AND_SIZE_MESSAGE, pos, size, d.length);
+                  LocalizedFormats.POSITION_SIZE_MISMATCH_INPUT_ARRAY, pos, size, d.length);
         }
         data = new double[size];
         System.arraycopy(d, pos, data, 0, size);
@@ -143,7 +140,7 @@ public class ArrayRealVector extends Abs
     public ArrayRealVector(Double[] d, int pos, int size) {
         if (d.length < pos + size) {
             throw MathRuntimeException.createIllegalArgumentException(
-                  NON_FITTING_POSITION_AND_SIZE_MESSAGE, pos, size, d.length);
+                  LocalizedFormats.POSITION_SIZE_MISMATCH_INPUT_ARRAY, pos, size, d.length);
         }
         data = new double[size];
         for (int i = pos; i < pos + size; i++) {
@@ -910,7 +907,7 @@ public class ArrayRealVector extends Abs
     public RealVector unitVector() throws ArithmeticException {
         final double norm = getNorm();
         if (norm == 0) {
-            throw MathRuntimeException.createArithmeticException("zero norm");
+            throw MathRuntimeException.createArithmeticException(LocalizedFormats.ZERO_NORM);
         }
         return mapDivide(norm);
     }
@@ -920,7 +917,7 @@ public class ArrayRealVector extends Abs
     public void unitize() throws ArithmeticException {
         final double norm = getNorm();
         if (norm == 0) {
-            throw MathRuntimeException.createArithmeticException("cannot normalize a zero norm vector");
+            throw MathRuntimeException.createArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
         }
         mapDivideToSelf(norm);
     }
@@ -1135,7 +1132,7 @@ public class ArrayRealVector extends Abs
         throws IllegalArgumentException {
         if (data.length != n) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     data.length, n);
         }
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BigMatrixImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BigMatrixImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BigMatrixImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BigMatrixImpl.java Wed Jun 16 23:03:38 2010
@@ -20,6 +20,7 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Implementation of {@link BigMatrix} using a BigDecimal[][] array to store entries
@@ -101,15 +102,13 @@ public class BigMatrixImpl implements Bi
      *  positive
      */
     public BigMatrixImpl(int rowDimension, int columnDimension) {
-        if (rowDimension <= 0 ) {
+        if (rowDimension < 1 ) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid row dimension {0} (must be positive)",
-                    rowDimension);
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, rowDimension, 1);
         }
-        if (columnDimension <= 0) {
+        if (columnDimension < 1) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "invalid column dimension {0} (must be positive)",
-                    columnDimension);
+                    LocalizedFormats.INSUFFICIENT_DIMENSION, columnDimension, 1);
         }
         data = new BigDecimal[rowDimension][columnDimension];
         lu = null;
@@ -156,17 +155,17 @@ public class BigMatrixImpl implements Bi
             }
             final int nRows = d.length;
             if (nRows == 0) {
-                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+                throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
             }
 
             final int nCols = d[0].length;
             if (nCols == 0) {
-                throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+                throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             for (int r = 1; r < nRows; r++) {
                 if (d[r].length != nCols) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                          "some rows have length {0} while others have length {1}",
+                          LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                           nCols, d[r].length);
                 }
             }
@@ -189,17 +188,17 @@ public class BigMatrixImpl implements Bi
     public BigMatrixImpl(double[][] d) {
         final int nRows = d.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
 
         final int nCols = d[0].length;
         if (nCols == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         for (int row = 1; row < nRows; row++) {
             if (d[row].length != nCols) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      "some rows have length {0} while others have length {1}",
+                      LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                       nCols, d[row].length);
             }
         }
@@ -219,17 +218,17 @@ public class BigMatrixImpl implements Bi
     public BigMatrixImpl(String[][] d) {
         final int nRows = d.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
 
         final int nCols = d[0].length;
         if (nCols == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         for (int row = 1; row < nRows; row++) {
             if (d[row].length != nCols) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      "some rows have length {0} while others have length {1}",
+                      LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                       nCols, d[row].length);
             }
         }
@@ -604,14 +603,14 @@ public class BigMatrixImpl implements Bi
         MatrixUtils.checkRowIndex(this, startRow);
         MatrixUtils.checkRowIndex(this, endRow);
         if (startRow > endRow) {
-            throw new MatrixIndexException("initial row {0} after final row {1}",
+            throw new MatrixIndexException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            startRow, endRow);
         }
 
         MatrixUtils.checkColumnIndex(this, startColumn);
         MatrixUtils.checkColumnIndex(this, endColumn);
         if (startColumn > endColumn) {
-            throw new MatrixIndexException("initial column {0} after final column {1}",
+            throw new MatrixIndexException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN,
                                            startColumn, endColumn);
         }
 
@@ -643,9 +642,9 @@ public class BigMatrixImpl implements Bi
 
         if (selectedRows.length * selectedColumns.length == 0) {
             if (selectedRows.length == 0) {
-                throw new MatrixIndexException("empty selected row index array");
+                throw new MatrixIndexException(LocalizedFormats.EMPTY_SELECTED_ROW_INDEX_ARRAY);
             }
-            throw new MatrixIndexException("empty selected column index array");
+            throw new MatrixIndexException(LocalizedFormats.EMPTY_SELECTED_COLUMN_INDEX_ARRAY);
         }
 
         final BigDecimal[][] subMatrixData =
@@ -703,18 +702,18 @@ public class BigMatrixImpl implements Bi
 
         final int nRows = subMatrix.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one row");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
 
         final int nCols = subMatrix[0].length;
         if (nCols == 0) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
 
         for (int r = 1; r < nRows; r++) {
             if (subMatrix[r].length != nCols) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                      "some rows have length {0} while others have length {1}",
+                      LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                       nCols, subMatrix[r].length);
             }
         }
@@ -722,12 +721,12 @@ public class BigMatrixImpl implements Bi
         if (data == null) {
             if (row > 0) {
                 throw MathRuntimeException.createIllegalStateException(
-                        "first {0} rows are not initialized yet",
+                        LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET,
                         row);
             }
             if (column > 0) {
                 throw MathRuntimeException.createIllegalStateException(
-                        "first {0} columns are not initialized yet",
+                        LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET,
                         column);
             }
             data = new BigDecimal[nRows][nCols];
@@ -881,7 +880,7 @@ public class BigMatrixImpl implements Bi
             return data[row][column];
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1027,7 +1026,7 @@ public class BigMatrixImpl implements Bi
     public BigDecimal[] operate(BigDecimal[] v) throws IllegalArgumentException {
         if (v.length != getColumnDimension()) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, getColumnDimension() );
         }
         final int nRows = this.getRowDimension();
@@ -1069,7 +1068,7 @@ public class BigMatrixImpl implements Bi
         final int nRows = this.getRowDimension();
         if (v.length != nRows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, nRows );
         }
         final int nCols = this.getColumnDimension();
@@ -1099,7 +1098,7 @@ public class BigMatrixImpl implements Bi
         final int nRows = this.getRowDimension();
         if (b.length != nRows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     b.length, nRows);
         }
         final BigMatrix bMatrix = new BigMatrixImpl(b);
@@ -1144,7 +1143,7 @@ public class BigMatrixImpl implements Bi
     public BigMatrix solve(BigMatrix b) throws IllegalArgumentException, InvalidMatrixException  {
         if (b.getRowDimension() != getRowDimension()) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     b.getRowDimension(), b.getColumnDimension(), getRowDimension(), "n");
         }
         if (!isSquare()) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Cache-friendly implementation of FieldMatrix using a flat arrays to store
@@ -218,7 +219,7 @@ public class BlockFieldMatrix<T extends 
             final int length = rawData[i].length;
             if (length != columns) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "some rows have length {0} while others have length {1}",
+                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                         columns, length);
             }
         }
@@ -809,7 +810,7 @@ public class BlockFieldMatrix<T extends 
         // safety checks
         final int refLength = subMatrix[0].length;
         if (refLength < 1) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         final int endRow    = row + subMatrix.length - 1;
         final int endColumn = column + refLength - 1;
@@ -817,7 +818,7 @@ public class BlockFieldMatrix<T extends 
         for (final T[] subRow : subMatrix) {
             if (subRow.length != refLength) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "some rows have length {0} while others have length {1}",
+                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                         refLength, subRow.length);
             }
         }
@@ -917,7 +918,7 @@ public class BlockFieldMatrix<T extends 
         if ((matrix.getRowDimension() != 1) ||
             (matrix.getColumnDimension() != nCols)) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     matrix.getRowDimension(), matrix.getColumnDimension(),
                     1, nCols);
         }
@@ -1006,7 +1007,7 @@ public class BlockFieldMatrix<T extends 
         if ((matrix.getRowDimension() != nRows) ||
             (matrix.getColumnDimension() != 1)) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     matrix.getRowDimension(), matrix.getColumnDimension(),
                     nRows, 1);
         }
@@ -1134,7 +1135,7 @@ public class BlockFieldMatrix<T extends 
         final int nCols = getColumnDimension();
         if (array.length != nCols) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     1, array.length, 1, nCols);
         }
 
@@ -1185,7 +1186,7 @@ public class BlockFieldMatrix<T extends 
         final int nRows = getRowDimension();
         if (array.length != nRows) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     array.length, 1, nRows, 1);
         }
 
@@ -1216,7 +1217,7 @@ public class BlockFieldMatrix<T extends 
             return blocks[iBlock * blockColumns + jBlock][k];
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1233,7 +1234,7 @@ public class BlockFieldMatrix<T extends 
             blocks[iBlock * blockColumns + jBlock][k] = value;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1251,7 +1252,7 @@ public class BlockFieldMatrix<T extends 
             blockIJ[k] = blockIJ[k].add(increment);
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1269,7 +1270,7 @@ public class BlockFieldMatrix<T extends 
             blockIJ[k] = blockIJ[k].multiply(factor);
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1334,7 +1335,7 @@ public class BlockFieldMatrix<T extends 
 
         if (v.length != columns) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, columns);
         }
         final T[] out = buildArray(getField(), rows);
@@ -1380,7 +1381,7 @@ public class BlockFieldMatrix<T extends 
 
         if (v.length != rows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, rows);
         }
         final T[] out = buildArray(getField(), columns);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java Wed Jun 16 23:03:38 2010
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import java.util.Arrays;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Cache-friendly implementation of RealMatrix using a flat arrays to store
@@ -167,7 +168,7 @@ public class BlockRealMatrix extends Abs
             for (int jBlock = 0; jBlock < blockColumns; ++jBlock, ++index) {
                 if (blockData[index].length != iHeight * blockWidth(jBlock)) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                            "wrong array shape (block length = {0}, expected {1})",
+                            LocalizedFormats.WRONG_BLOCK_LENGTH,
                             blockData[index].length, iHeight * blockWidth(jBlock));
                 }
                 if (copyArray) {
@@ -213,7 +214,7 @@ public class BlockRealMatrix extends Abs
             final int length = rawData[i].length;
             if (length != columns) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "some rows have length {0} while others have length {1}",
+                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                         columns, length);
             }
         }
@@ -835,7 +836,7 @@ public class BlockRealMatrix extends Abs
         // safety checks
         final int refLength = subMatrix[0].length;
         if (refLength < 1) {
-            throw MathRuntimeException.createIllegalArgumentException("matrix must have at least one column");
+            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         final int endRow    = row + subMatrix.length - 1;
         final int endColumn = column + refLength - 1;
@@ -843,7 +844,7 @@ public class BlockRealMatrix extends Abs
         for (final double[] subRow : subMatrix) {
             if (subRow.length != refLength) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "some rows have length {0} while others have length {1}",
+                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
                         refLength, subRow.length);
             }
         }
@@ -943,7 +944,7 @@ public class BlockRealMatrix extends Abs
         if ((matrix.getRowDimension() != 1) ||
             (matrix.getColumnDimension() != nCols)) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     matrix.getRowDimension(), matrix.getColumnDimension(),
                     1, nCols);
         }
@@ -1032,7 +1033,7 @@ public class BlockRealMatrix extends Abs
         if ((matrix.getRowDimension() != nRows) ||
             (matrix.getColumnDimension() != 1)) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     matrix.getRowDimension(), matrix.getColumnDimension(),
                     nRows, 1);
         }
@@ -1160,7 +1161,7 @@ public class BlockRealMatrix extends Abs
         final int nCols = getColumnDimension();
         if (array.length != nCols) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     1, array.length, 1, nCols);
         }
 
@@ -1211,7 +1212,7 @@ public class BlockRealMatrix extends Abs
         final int nRows = getRowDimension();
         if (array.length != nRows) {
             throw new InvalidMatrixException(
-                    "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                     array.length, 1, nRows, 1);
         }
 
@@ -1242,7 +1243,7 @@ public class BlockRealMatrix extends Abs
             return blocks[iBlock * blockColumns + jBlock][k];
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1259,7 +1260,7 @@ public class BlockRealMatrix extends Abs
             blocks[iBlock * blockColumns + jBlock][k] = value;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1276,7 +1277,7 @@ public class BlockRealMatrix extends Abs
             blocks[iBlock * blockColumns + jBlock][k] += increment;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1293,7 +1294,7 @@ public class BlockRealMatrix extends Abs
             blocks[iBlock * blockColumns + jBlock][k] *= factor;
         } catch (ArrayIndexOutOfBoundsException e) {
             throw new MatrixIndexException(
-                    "no entry at indices ({0}, {1}) in a {2}x{3} matrix",
+                    LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                     row, column, getRowDimension(), getColumnDimension());
         }
     }
@@ -1358,7 +1359,7 @@ public class BlockRealMatrix extends Abs
 
         if (v.length != columns) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, columns);
         }
         final double[] out = new double[rows];
@@ -1402,7 +1403,7 @@ public class BlockRealMatrix extends Abs
 
         if (v.length != rows) {
             throw MathRuntimeException.createIllegalArgumentException(
-                    "vector length mismatch: got {0} but expected {1}",
+                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                     v.length, rows);
         }
         final double[] out = new double[columns];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java Wed Jun 16 23:03:38 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 
 /**
@@ -212,7 +213,7 @@ public class CholeskyDecompositionImpl i
             final int m = lTData.length;
             if (b.length != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}",
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                         b.length, m);
             }
 
@@ -251,7 +252,7 @@ public class CholeskyDecompositionImpl i
                 final int m = lTData.length;
                 if (b.getDimension() != m) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                            "vector length mismatch: got {0} but expected {1}",
+                            LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                             b.getDimension(), m);
                 }
 
@@ -300,7 +301,7 @@ public class CholeskyDecompositionImpl i
             final int m = lTData.length;
             if (b.getRowDimension() != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                        LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                         b.getRowDimension(), b.getColumnDimension(), m, "n");
             }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java Wed Jun 16 23:03:38 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.linear;
 
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
+import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 
 /**
@@ -102,7 +103,7 @@ public class EigenDecompositionImpl impl
             // NOT supported
             // see issue https://issues.apache.org/jira/browse/MATH-235
             throw new InvalidMatrixException(
-                    "eigen decomposition of assymetric matrices not supported yet");
+                    LocalizedFormats.ASSYMETRIC_EIGEN_NOT_SUPPORTED);
         }
     }
 
@@ -291,7 +292,7 @@ public class EigenDecompositionImpl impl
             final int m = realEigenvalues.length;
             if (b.length != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}",
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                         b.length, m);
             }
 
@@ -333,7 +334,7 @@ public class EigenDecompositionImpl impl
             final int m = realEigenvalues.length;
             if (b.getDimension() != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}", b
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH, b
                                 .getDimension(), m);
             }
 
@@ -376,7 +377,7 @@ public class EigenDecompositionImpl impl
             if (b.getRowDimension() != m) {
                 throw MathRuntimeException
                         .createIllegalArgumentException(
-                                "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                                LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                                 b.getRowDimension(), b.getColumnDimension(), m,
                                 "n");
             }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java?rev=955423&r1=955422&r2=955423&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java Wed Jun 16 23:03:38 2010
@@ -22,6 +22,7 @@ import java.lang.reflect.Array;
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.LocalizedFormats;
 
 /**
  * Calculates the LUP-decomposition of a square matrix.
@@ -263,7 +264,7 @@ public class FieldLUDecompositionImpl<T 
             final int m = pivot.length;
             if (b.length != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "vector length mismatch: got {0} but expected {1}",
+                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                         b.length, m);
             }
             if (singular) {
@@ -309,7 +310,7 @@ public class FieldLUDecompositionImpl<T 
                 final int m = pivot.length;
                 if (b.getDimension() != m) {
                     throw MathRuntimeException.createIllegalArgumentException(
-                            "vector length mismatch: got {0} but expected {1}",
+                            LocalizedFormats.VECTOR_LENGTH_MISMATCH,
                             b.getDimension(), m);
                 }
                 if (singular) {
@@ -365,7 +366,7 @@ public class FieldLUDecompositionImpl<T 
             final int m = pivot.length;
             if (b.getRowDimension() != m) {
                 throw MathRuntimeException.createIllegalArgumentException(
-                        "dimensions mismatch: got {0}x{1} but expected {2}x{3}",
+                        LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
                         b.getRowDimension(), b.getColumnDimension(), m, "n");
             }
             if (singular) {



Mime
View raw message