Răsfoiți Sursa

Fix for sort that broke graphs.

A shadow-copy was made and sorted, now a deep-copy is made an sorted.
The order of the original array is now no longer altered in the process
of determining some statistical values.
Kenneth van Ewijk 11 ani în urmă
părinte
comite
139db8fb13
1 a modificat fișierele cu 9 adăugiri și 2 ștergeri
  1. 9 2
      StatisticsCalculator.java

+ 9 - 2
StatisticsCalculator.java

@@ -40,8 +40,15 @@ public class StatisticsCalculator {
         return avg;
         return avg;
     }
     }
     
     
-      public static double median(ArrayList<Double> array){
-    	Collections.sort(array);							//sort the array
+      public static double median(ArrayList<Double> array2){
+    	ArrayList<Double> array = new ArrayList<Double>();
+    	
+    	for(double db : array2)
+    	{
+    	    array.add(db);
+    	}
+          
+        Collections.sort(array);							//sort the array
     	
     	
     	double median = 0;
     	double median = 0;
     	int middle = array.size()/2; 						//calculate the middle of the array
     	int middle = array.size()/2; 						//calculate the middle of the array