src/main/java/it/uniroma2/dicii/sabd/covidproject/Query1.java
/* Utility method that performs the second phase of absolute statistics computation from cumulative measurements
    *  (see main() below)*/
Utility method that performs the second phase of absolute statistics computation from cumulative measurements
below)
Utility method that performs the second phase of absolute statistics computation from cumulative measurements below )
private static ItalianWeeklyStats computeAbsoluteStats(Iterable<ItalianWeeklyStats> values) {
        ItalianWeeklyStats absoluteWeeklyStats = new ItalianWeeklyStats();
        List<ItalianWeeklyStats> valuesList = new ArrayList<>();
        for (ItalianWeeklyStats value : values) {
            valuesList.add(value);
        }
        Float cured1 = valuesList.get(0).getCured();
        Float swabs1 = valuesList.get(0).getSwabs();
        Float cured2;
        Float swabs2;
        if (valuesList.size() == 1) {
            cured2 = 0F;
            swabs2 = 0F;
        } else {
            cured2 = valuesList.get(1).getCured();
            swabs2 = valuesList.get(1).getSwabs();
        }
        absoluteWeeklyStats.setCured(Math.abs(cured1 - cured2) / 7);
        absoluteWeeklyStats.setSwabs(Math.abs(swabs1 - swabs2) / 7);
        return absoluteWeeklyStats;
    }
private static ItalianWeeklyStats computeAbsoluteStats ( Iterable < ItalianWeeklyStats > values ) { ItalianWeeklyStats absoluteWeeklyStats = new ItalianWeeklyStats ( ) ; List < ItalianWeeklyStats > valuesList = new ArrayList < > ( ) ; for ( ItalianWeeklyStats value : values ) { valuesList . add ( value ) ; } Float cured1 = valuesList . get ( 0 ) . getCured ( ) ; Float swabs1 = valuesList . get ( 0 ) . getSwabs ( ) ; Float cured2 ; Float swabs2 ; if ( valuesList . size ( ) == 1 ) { cured2 = 0F ; swabs2 = 0F ; } else { cured2 = valuesList . get ( 1 ) . getCured ( ) ; swabs2 = valuesList . get ( 1 ) . getSwabs ( ) ; } absoluteWeeklyStats . setCured ( Math . abs ( cured1 - cured2 ) / 7 ) ; absoluteWeeklyStats . setSwabs ( Math . abs ( swabs1 - swabs2 ) / 7 ) ; return absoluteWeeklyStats ; }
Utility method that performs the second phase of absolute statistics computation from cumulative measurements
  (see main() below)
Utility method that performs the second phase of absolute statistics computation from cumulative measurements ( see main () below )