package com.dis;

import java.util.*;

/**
 * Created by Kasimir on 04.07.2017.
 */
public class DisplayData {
    public List<CityData> allData;

    public DisplayData(){
        allData = new ArrayList<CityData>();
    }

    public void add(String city, Date date, String article, int amount) {
        boolean cityavailable = false;
        for (CityData cd: allData)
        {
            if(cd.cityName.equals(city))
            {
                cd.add(date,article,amount);
                cityavailable = true;
                break;
            }
        }
        if(!cityavailable && city != null)
        {
            CityData newData = new CityData(city);
            newData.add(date,article,amount);
            allData.add(newData);
        }
    }

    public  List<List<String>> makeOutput(List<String> headers)
    {
        List<List<String>> result = new ArrayList<List<String>>();

        for(CityData cd: allData)
        {
            List<List<String>> cityresults = cd.makeOutput(headers);
            result.addAll(cityresults);
        }
        return result;
    }


}
@@ -116,28 +116,32 @@
 public List%3C
-City
+Location
 Data%3E allDat
@@ -202,20 +202,24 @@
 rayList%3C
-City
+Location
 Data%3E();
@@ -352,20 +352,24 @@
    for (
-City
+Location
 Data cd:
@@ -638,20 +638,24 @@
         
-City
+Location
 Data new
@@ -665,20 +665,24 @@
 a = new 
-City
+Location
 Data(cit
@@ -936,12 +936,16 @@
 for(
-City
+Location
 Data

rename locationdata