Kashin M.I. Lab work 4 #9

Closed
Sosees04ka wants to merge 2 commits from LabWork04_fix into LabWork03
Showing only changes of commit 5db0520322 - Show all commits

38
src/MapsCollection.java Normal file
View File

@ -0,0 +1,38 @@
import java.util.ArrayList;
import java.util.HashMap;
public class MapsCollection {
Review

Нет индексатора с 2 параметрами

Нет индексатора с 2 параметрами
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;
}
}