diff options
Diffstat (limited to 'src/ch/epfl/maze/util/Statistics.java')
-rw-r--r-- | src/ch/epfl/maze/util/Statistics.java | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/ch/epfl/maze/util/Statistics.java b/src/ch/epfl/maze/util/Statistics.java index ae16392..3928859 100644 --- a/src/ch/epfl/maze/util/Statistics.java +++ b/src/ch/epfl/maze/util/Statistics.java | |||
@@ -8,7 +8,6 @@ import java.util.*; | |||
8 | /** | 8 | /** |
9 | * Utility class that allows to compute statistics on a list of results. | 9 | * Utility class that allows to compute statistics on a list of results. |
10 | */ | 10 | */ |
11 | |||
12 | public final class Statistics { | 11 | public final class Statistics { |
13 | 12 | ||
14 | /* constants for the length of the distribution axis */ | 13 | /* constants for the length of the distribution axis */ |
@@ -21,7 +20,6 @@ public final class Statistics { | |||
21 | * @param results List of numbers | 20 | * @param results List of numbers |
22 | * @return The total of the list | 21 | * @return The total of the list |
23 | */ | 22 | */ |
24 | |||
25 | public static int total(List<Integer> results) { | 23 | public static int total(List<Integer> results) { |
26 | int total = 0; | 24 | int total = 0; |
27 | for (Integer result : results) { | 25 | for (Integer result : results) { |
@@ -41,7 +39,6 @@ public final class Statistics { | |||
41 | * @param results List of numbers | 39 | * @param results List of numbers |
42 | * @return The mean of the results | 40 | * @return The mean of the results |
43 | */ | 41 | */ |
44 | |||
45 | public static int mean(List<Integer> results) { | 42 | public static int mean(List<Integer> results) { |
46 | int total = total(results); | 43 | int total = total(results); |
47 | if (total == Integer.MAX_VALUE) { | 44 | if (total == Integer.MAX_VALUE) { |
@@ -58,7 +55,6 @@ public final class Statistics { | |||
58 | * @param results List of numbers | 55 | * @param results List of numbers |
59 | * @return The variance of the results | 56 | * @return The variance of the results |
60 | */ | 57 | */ |
61 | |||
62 | public static double var(List<Integer> results) { | 58 | public static double var(List<Integer> results) { |
63 | double mean = mean(results); | 59 | double mean = mean(results); |
64 | if (mean == Integer.MAX_VALUE) { | 60 | if (mean == Integer.MAX_VALUE) { |
@@ -79,7 +75,6 @@ public final class Statistics { | |||
79 | * @param results List of numbers | 75 | * @param results List of numbers |
80 | * @return The variance of the results | 76 | * @return The variance of the results |
81 | */ | 77 | */ |
82 | |||
83 | public static double std(List<Integer> results) { | 78 | public static double std(List<Integer> results) { |
84 | return Math.sqrt(var(results)); | 79 | return Math.sqrt(var(results)); |
85 | } | 80 | } |
@@ -90,7 +85,6 @@ public final class Statistics { | |||
90 | * @param simulation Simulation to make statistics on | 85 | * @param simulation Simulation to make statistics on |
91 | * @param numberOfSimulations The number of simulations | 86 | * @param numberOfSimulations The number of simulations |
92 | */ | 87 | */ |
93 | |||
94 | public static Map<String, List<Integer>> computeStatistics( | 88 | public static Map<String, List<Integer>> computeStatistics( |
95 | Simulation simulation, int numberOfSimulations) { | 89 | Simulation simulation, int numberOfSimulations) { |
96 | // maps animals' names with their overall results (which are linked-list) | 90 | // maps animals' names with their overall results (which are linked-list) |
@@ -128,7 +122,6 @@ public final class Statistics { | |||
128 | * | 122 | * |
129 | * @param results List of numbers | 123 | * @param results List of numbers |
130 | */ | 124 | */ |
131 | |||
132 | public static void printDistribution(List<Integer> results) { | 125 | public static void printDistribution(List<Integer> results) { |
133 | 126 | ||
134 | int min = results.get(0); | 127 | int min = results.get(0); |
@@ -181,4 +174,5 @@ public final class Statistics { | |||
181 | } | 174 | } |
182 | System.out.println(">"); | 175 | System.out.println(">"); |
183 | } | 176 | } |
177 | |||
184 | } | 178 | } |