src/main/java/it/uniroma2/dicii/sabd/covidproject/Query2.java
/*
    * For each one of the top-100 affected regions, the method generates a list of (k,v) pairs, where k is a combination
    * of the region continent and a week and v is the array of daily increments reported in that week.
    * */
For each one of the top-100 affected regions, the method generates a list of (k,v) pairs, where k is a combination
of the region continent and a week and v is the array of daily increments reported in that week.
For each one of the top - 100 affected regions the method generates a list of ( k v ) pairs where k is a combination of the region continent and a week and v is the array of daily increments reported in that week .
private static Iterator<Tuple2<String, Double[]>> mapDataToWeekAndContinent(Tuple2<Tuple2<Double, RegionData>,Long> regionData) {
        /* Continent identification is made using latitude and longitude through the utility class UtilsContinent */
        UtilsContinent utilsContinent = new UtilsContinent();
        UtilsContinent.Continent continent =  utilsContinent.getContinentFromLatLong(regionData._1._2.getLatitude(), regionData._1._2.getLongitude());
        List<Tuple2<String, Double[]>> output = new ArrayList<>();
        Double[] confirmedDailyIncrements = regionData._1._2.getConfirmedDailyIncrements();
        int numOfWeeks = confirmedDailyIncrements.length / 7;
        /* For each available week, an array of daily increments is produced and emitted along with the continent and the week index */
        for (int k = 0; k < numOfWeeks; k++) {
            Double[] weeklyIncrements = new Double[7];
            System.arraycopy(confirmedDailyIncrements, k * 7, weeklyIncrements, 0, 7);
            String key = continent.toString() + "," + (k + FIRST_WEEK_OF_OBSERVATION);
            output.add(new Tuple2<>(key, weeklyIncrements));
        }
        return output.iterator();
    }
private static Iterator < Tuple2 < String , Double [ ] > > mapDataToWeekAndContinent ( Tuple2 < Tuple2 < Double , RegionData > , Long > regionData ) { /* Continent identification is made using latitude and longitude through the utility class UtilsContinent */ UtilsContinent utilsContinent = new UtilsContinent ( ) ; UtilsContinent . Continent continent = utilsContinent . getContinentFromLatLong ( regionData . _1 . _2 . getLatitude ( ) , regionData . _1 . _2 . getLongitude ( ) ) ; List < Tuple2 < String , Double [ ] > > output = new ArrayList < > ( ) ; Double [ ] confirmedDailyIncrements = regionData . _1 . _2 . getConfirmedDailyIncrements ( ) ; int numOfWeeks = confirmedDailyIncrements . length / 7 ; /* For each available week, an array of daily increments is produced and emitted along with the continent and the week index */ for ( int k = 0 ; k < numOfWeeks ; k ++ ) { Double [ ] weeklyIncrements = new Double [ 7 ] ; System . arraycopy ( confirmedDailyIncrements , k * 7 , weeklyIncrements , 0 , 7 ) ; String key = continent . toString ( ) + "," + ( k + FIRST_WEEK_OF_OBSERVATION ) ; output . add ( new Tuple2 < > ( key , weeklyIncrements ) ) ; } return output . iterator ( ) ; }
For each one of the top-100 affected regions, the method generates a list of (k,v) pairs, where k is a combination
 of the region continent and a week and v is the array of daily increments reported in that week.
For each one of the top - 100 affected regions the method generates a list of ( k v ) pairs where k is a combination of the region continent and a week and v is the array of daily increments reported in that week .