src/main/java/it/uniroma2/dicii/sabd/covidproject/Query2.java
/*
    * Compute the statistics of interest for each combination of continents and weeks
    * */
Compute the statistics of interest for each combination of continents and weeks
Compute the statistics of interest for each combination of continents and weeks
private static ContinentWeeklyStats computeContinentWeeklyStats(Double[] continentWeeklyIncrements) {
        ContinentWeeklyStats continentWeeklyStats = new ContinentWeeklyStats();
        double[] continentWeeklyIncrementsDouble = new double[continentWeeklyIncrements.length];
        for (int i = 0; i < continentWeeklyIncrementsDouble.length; i++) {
            continentWeeklyIncrementsDouble[i] = continentWeeklyIncrements[i];
        }
        /* Computations are made using Apache Commons Math library */
        continentWeeklyStats.setMinConfirmed(StatUtils.min(continentWeeklyIncrementsDouble));
        continentWeeklyStats.setMaxConfirmed(StatUtils.max(continentWeeklyIncrementsDouble));
        continentWeeklyStats.setAvgConfirmed(StatUtils.mean(continentWeeklyIncrementsDouble));
        StandardDeviation standardDeviation = new StandardDeviation();
        continentWeeklyStats.setStdevConfirmed(standardDeviation.evaluate(continentWeeklyIncrementsDouble));
        return continentWeeklyStats;
    }
private static ContinentWeeklyStats computeContinentWeeklyStats ( Double [ ] continentWeeklyIncrements ) { ContinentWeeklyStats continentWeeklyStats = new ContinentWeeklyStats ( ) ; double [ ] continentWeeklyIncrementsDouble = new double [ continentWeeklyIncrements . length ] ; for ( int i = 0 ; i < continentWeeklyIncrementsDouble . length ; i ++ ) { continentWeeklyIncrementsDouble [ i ] = continentWeeklyIncrements [ i ] ; } /* Computations are made using Apache Commons Math library */ continentWeeklyStats . setMinConfirmed ( StatUtils . min ( continentWeeklyIncrementsDouble ) ) ; continentWeeklyStats . setMaxConfirmed ( StatUtils . max ( continentWeeklyIncrementsDouble ) ) ; continentWeeklyStats . setAvgConfirmed ( StatUtils . mean ( continentWeeklyIncrementsDouble ) ) ; StandardDeviation standardDeviation = new StandardDeviation ( ) ; continentWeeklyStats . setStdevConfirmed ( standardDeviation . evaluate ( continentWeeklyIncrementsDouble ) ) ; return continentWeeklyStats ; }
Compute the statistics of interest for each combination of continents and weeks
Compute the statistics of interest for each combination of continents and weeks