JAL-2379 made SparseMatrix.divide() so as to exactly match
[jalview.git] / src / jalview / ext / android / SparseDoubleArray.java
index 5ae5afe..eaf059c 100644 (file)
@@ -425,13 +425,17 @@ public class SparseDoubleArray implements Cloneable
    * @oparam toAdd
    * @return the new value for the key
    */
-  public double multiply(int key, double d)
+  public double divide(int key, double divisor)
   {
     double newValue = 0d;
+    if (divisor == 0d)
+    {
+      return newValue;
+    }
     int i = ContainerHelpers.binarySearch(mKeys, mSize, key);
     if (i >= 0)
     {
-      mValues[i] *= d;
+      mValues[i] /= divisor;
       newValue = mValues[i];
     }
     return newValue;