commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r280065 - in /jakarta/commons/proper/math/branches/MATH_1_1: src/java/org/apache/commons/math/util/ResizableDoubleArray.java xdocs/changes.xml
Date Sun, 11 Sep 2005 04:13:56 GMT
Author: psteitz
Date: Sat Sep 10 21:13:52 2005
New Revision: 280065

URL: http://svn.apache.org/viewcvs?rev=280065&view=rev
Log:
Synchronized getters in ResizeableDoubleArray.
PR# 36491 (findbugs)

Modified:
    jakarta/commons/proper/math/branches/MATH_1_1/src/java/org/apache/commons/math/util/ResizableDoubleArray.java
    jakarta/commons/proper/math/branches/MATH_1_1/xdocs/changes.xml

Modified: jakarta/commons/proper/math/branches/MATH_1_1/src/java/org/apache/commons/math/util/ResizableDoubleArray.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/branches/MATH_1_1/src/java/org/apache/commons/math/util/ResizableDoubleArray.java?rev=280065&r1=280064&r2=280065&view=diff
==============================================================================
--- jakarta/commons/proper/math/branches/MATH_1_1/src/java/org/apache/commons/math/util/ResizableDoubleArray.java
(original)
+++ jakarta/commons/proper/math/branches/MATH_1_1/src/java/org/apache/commons/math/util/ResizableDoubleArray.java
Sat Sep 10 21:13:52 2005
@@ -451,21 +451,19 @@
      * @throws ArrayIndexOutOfBoundsException if <code>index</code> is less than
      *         zero or is greater than <code>getNumElements() - 1</code>.
      */
-    public double getElement(int index) {
-        double value = Double.NaN;
+    public synchronized double getElement(int index) {
         if (index >= numElements) {
             String msg =
                 "The index specified: " + index +
                 " is larger than the current number of elements";
             throw new ArrayIndexOutOfBoundsException(msg);
         } else if (index >= 0) {
-            value = internalArray[startIndex + index];
+            return internalArray[startIndex + index];
         } else {
             String msg =
                 "Elements cannot be retrieved from a negative array index";
             throw new ArrayIndexOutOfBoundsException(msg);
         }
-        return value;
     }
     
      /**
@@ -475,7 +473,7 @@
      *  array have no effect on this <code>ResizableArray.</code>
      * @return the double array.
      */
-    public double[] getElements() {
+    public synchronized double[] getElements() {
         double[] elementArray = new double[numElements];
         System.arraycopy( internalArray, startIndex, elementArray, 0,
                 numElements);
@@ -517,7 +515,7 @@
      * 
      * @return the length of the internal storage array.
      */
-    int getInternalLength() {
+    synchronized int getInternalLength() {
         return (internalArray.length);
     }
 
@@ -527,7 +525,7 @@
      *
      * @return number of elements
      */
-    public int getNumElements() {
+    public synchronized int getNumElements() {
         return (numElements);
     }
     
@@ -542,7 +540,7 @@
      * 
      * @return the internal storage array used by this object
      */
-    public double[] getValues() {
+    public synchronized double[] getValues() {
         return (internalArray);
     }
 
@@ -683,7 +681,7 @@
      *
      * @return starting index
      */
-    public int start() {
+    public synchronized int start() {
         return startIndex;
     }
 

Modified: jakarta/commons/proper/math/branches/MATH_1_1/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/branches/MATH_1_1/xdocs/changes.xml?rev=280065&r1=280064&r2=280065&view=diff
==============================================================================
--- jakarta/commons/proper/math/branches/MATH_1_1/xdocs/changes.xml (original)
+++ jakarta/commons/proper/math/branches/MATH_1_1/xdocs/changes.xml Sat Sep 10 21:13:52 2005
@@ -46,6 +46,9 @@
        possible to replace the JDK-supplied random number generator in
        commons-math (and elsewhere) with alternative PRNG implementations.">
       <action dev="psteitz" type="fix" issue="36491">
+       Synchronized getters in ResizeableDoubleArray.
+      </action>
+      <action dev="psteitz" type="fix" issue="36491">
        Eliminated unnecessary assignment statement in BisectionSolver.solve
        method.
       </action>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message