PIbd-12_Karamushko_M.K._Air.../MapsCollection.java
2022-11-25 12:49:46 +03:00

39 lines
1.2 KiB
Java

import java.util.LinkedHashMap;
import java.util.List;
public class MapsCollection
{
public LinkedHashMap<String, MapWithSetAircraftsGeneric<DrawingObjectAircraft, AbstractMap>> _mapStorages;
private int _pictureWidth;
private int _pictureHeight;
public List<String> getKeys() { return _mapStorages.keySet().stream().toList(); }
public MapsCollection(int pictureWidth, int pictureHeight)
{
_mapStorages = new LinkedHashMap<>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
public void AddMap(String name, AbstractMap map)
{
// TODO Прописать логику для добавления
boolean check = _mapStorages.containsKey(name);
if (check) return;
_mapStorages.put(name, new MapWithSetAircraftsGeneric(_pictureWidth, _pictureHeight, map));
}
public void DelMap(String name)
{
// TODO Прописать логику для удаления
_mapStorages.remove(name);
}
public MapWithSetAircraftsGeneric<DrawingObjectAircraft, AbstractMap> getMap(String name)
{
return _mapStorages.getOrDefault(name, null);
}
}