public StatisticResult getResult()

in commons-statistics-descriptive/src/main/java/org/apache/commons/statistics/descriptive/IntStatistics.java [594:645]


    public StatisticResult getResult(Statistic statistic) {
        // Locate the implementation.
        // Statistics that wrap an underlying implementation are created in methods.
        // The return argument should be an interface reference and not an instance
        // of IntStatistic. This ensures the statistic implementation cannot
        // be updated with new values by casting the result and calling accept(int).
        StatisticResult stat = null;
        switch (statistic) {
        case GEOMETRIC_MEAN:
            stat = getGeometricMean();
            break;
        case KURTOSIS:
            stat = getKurtosis();
            break;
        case MAX:
            stat = Statistics.getResultAsIntOrNull(max);
            break;
        case MEAN:
            stat = getMean();
            break;
        case MIN:
            stat = Statistics.getResultAsIntOrNull(min);
            break;
        case PRODUCT:
            stat = Statistics.getResultAsDoubleOrNull(product);
            break;
        case SKEWNESS:
            stat = getSkewness();
            break;
        case STANDARD_DEVIATION:
            stat = getStandardDeviation();
            break;
        case SUM:
            stat = Statistics.getResultAsBigIntegerOrNull(sum);
            break;
        case SUM_OF_LOGS:
            stat = Statistics.getResultAsDoubleOrNull(sumOfLogs);
            break;
        case SUM_OF_SQUARES:
            stat = Statistics.getResultAsBigIntegerOrNull(sumOfSquares);
            break;
        case VARIANCE:
            stat = getVariance();
            break;
        default:
            break;
        }
        if (stat != null) {
            return stat;
        }
        throw new IllegalArgumentException(UNSUPPORTED_STATISTIC + statistic);
    }