final final final

This commit is contained in:
Кашин Максим 2022-11-16 11:41:31 +04:00
parent 0a95106eb9
commit 5db0520322

38
src/MapsCollection.java Normal file
View File

@ -0,0 +1,38 @@
import java.util.ArrayList;
import java.util.HashMap;
public class MapsCollection {
private final HashMap<String,MapWithSetGasolineTankerGeneric<DrawingObjectGasolineTanker,AbstractMap>> _mapStorages;
private final int _pictureWidth;
private final int _pictureHeight;
public MapsCollection(int pictureWidth,int pictureHeight){
_mapStorages=new HashMap<>();
_pictureWidth=pictureWidth;
_pictureHeight=pictureHeight;
}
public ArrayList<String> Keys(){
return new ArrayList<>(_mapStorages.keySet());
}
public void AddMap(String name, AbstractMap map){
if (_mapStorages.containsKey(name)){
return;
}
else{
_mapStorages.put(name,new MapWithSetGasolineTankerGeneric<>(_pictureWidth,_pictureHeight,map));
}
}
public void DelMap(String name){
_mapStorages.remove(name);
}
public MapWithSetGasolineTankerGeneric<DrawingObjectGasolineTanker,AbstractMap> get(String name){
if (_mapStorages.containsKey(name)){
return _mapStorages.get(name);
}
return null;
}
}