PIbd-12_Karamushko_M.K._Air.../MapsCollection.java

39 lines
1.2 KiB
Java
Raw Normal View History

2022-11-25 13:49:46 +04:00
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);
}
}