commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1003606 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception: MatrixDimensionMismatchException.java MultiDimensionMismatchException.java
Date Fri, 01 Oct 2010 18:10:47 GMT
Author: erans
Date: Fri Oct  1 18:10:46 2010
New Revision: 1003606

URL: http://svn.apache.org/viewvc?rev=1003606&view=rev
Log:
MATH-424
Safe handling of internal data.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java?rev=1003606&r1=1003605&r2=1003606&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java
Fri Oct  1 18:10:46 2010
@@ -50,24 +50,24 @@ public class MatrixDimensionMismatchExce
      * @return the expected row dimension.
      */
     public int getWrongRowDimension() {
-        return getWrongDimensions()[0];
+        return getWrongDimension(0);
     }
     /**
      * @return the expected row dimension.
      */
     public int getExpectedRowDimension() {
-        return getExpectedDimensions()[0];
+        return getExpectedDimension(0);
     }
     /**
      * @return the wrong column dimension.
      */
     public int getWrongColumnDimension() {
-        return getWrongDimensions()[1];
+        return getWrongDimension(1);
     }
     /**
      * @return the expected column dimension.
      */
     public int getExpectedColumnDimension() {
-        return getExpectedDimensions()[1];
+        return getExpectedDimension(1);
     }
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java?rev=1003606&r1=1003605&r2=1003606&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java
Fri Oct  1 18:10:46 2010
@@ -62,15 +62,29 @@ public class MultiDimensionMismatchExcep
     }
 
     /**
-     * @return a reference to the array containing the wrong dimensions.
+     * @return an array containing the wrong dimensions.
      */
     public Integer[] getWrongDimensions() {
-        return wrong;
+        return wrong.clone();
     }
     /**
-     * @return a reference to the array containing the expected dimensions.
+     * @return an array containing the expected dimensions.
      */
     public Integer[] getExpectedDimensions() {
-        return expected;
+        return expected.clone();
+    }
+
+    /**
+     * @param index Dimension index.
+     * @return the wrong dimension stored at {@code index}.
+     */
+    public int getWrongDimension(int index) {
+        return wrong[index];
+    }
+    /**
+     * @return an the expected dimension stored at {@code index}..
+     */
+    public int getExpectedDimension(int index) {
+        return expected[index];
     }
 }



Mime
View raw message