@@ -0,0 +1,1001 @@
+package cz.cuni.mff.d3s.spl.core.data;%0A%0Aimport java.util.Collection;%0A%0A%0Apublic class PrecomputedStatistics implements Statistics %7B%0A%09private double mean = 0.0;%0A%09private long len = 0;%0A%0A%09public static PrecomputedStatistics create(Collection%3CLong%3E samples) %7B%0A%09%09PrecomputedStatistics result = new PrecomputedStatistics();%0A%09%09result.mean = getSampleMean(samples);%0A%09%09result.len = samples.size();%0A%09%09return result;%0A%09%7D%0A%0A%09@Override%0A%09public double getArithmeticMean() %7B%0A%09%09return mean;%0A%09%7D%0A%09%0A%09@Override%0A%09public String toString() %7B%0A%09%09return String.format(%22Statistics(size=%25d, mean=%252.2f)%22,%0A%09%09%09%09len, mean);%0A%09%7D%0A%0A%09/**%0A%09 * Compute arithmetic mean from given list.%0A%09 * %0A%09 * @param samples%0A%09 *            List of samples.%0A%09 * @return Arithmetic mean.%0A%09 * @retval 0 When list is empty.%0A%09 */%0A%09protected static double getSampleMean(Collection%3CLong%3E samples) %7B%0A%09%09if (samples.size() == 0) %7B%0A%09%09%09return 0.0;%0A%09%09%7D%0A%09%09double sum = 0.0;%0A%09%09for (Long l : samples) %7B%0A%09%09%09sum += (double) l;%0A%09%09%7D%0A%09%09return sum / (double) samples.size();%0A%09%7D%0A%0A%7D%0A

Add simple Statistics implementation