package com.axel_nicolas.tub.data.manager;

import com.axel_nicolas.tub.data.model.LineModel;
import com.axel_nicolas.tub.data.model.StopModel;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by axell on 04/11/2016.
 */

public class CacheManagerImpl implements CacheManager {

    private HashMap<String, LineModel> lineModels;
    private HashMap<String, StopModel> stopModels;

    @Override
    public List<LineModel> getLines() {
        List<LineModel> lineModels = new ArrayList<>();
        lineModels.addAll(this.lineModels.values());
        return lineModels;
    }


    @Override
    public void setLines(List<LineModel> lineModels) {
        for (LineModel lineModel : lineModels) {
            setLine(lineModel);
        }
    }

    @Override
    public LineModel getLine(String id) {
        return this.lineModels.get(id);
    }

    @Override
    public void setLine(LineModel lineModel) {
        this.lineModels.put(lineModel.getId(), lineModel);
    }


    @Override
    public List<StopModel> getStops() {
        List<StopModel> stopModels = new ArrayList<>();
        stopModels.addAll(this.stopModels.values());
        return stopModels;
    }

    @Override
    public void setStops(List<StopModel> stopModels) {
        for (StopModel stopModel : stopModels) {
          setStop(stopModel);
        }
    }

    @Override
    public StopModel getStop(String id) {
        return this.stopModels.get(id);
    }

    @Override
    public void setStop(StopModel stopModel) {
        this.stopModels.put(stopModel.getId(), stopModel);
    }

}

@@ -420,16 +420,142 @@
 odels;%0A%0A
+%0A    public CacheManagerImpl() %7B%0A        this.lineModels = new HashMap%3C%3E();%0A        this.stopModels = new HashMap%3C%3E();%0A    %7D%0A%0A
     @Ove

Fix HashMaps