41 lines
1.1 KiB
Java
41 lines
1.1 KiB
Java
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.HashMap;
|
||
|
|
||
|
public class MapsCollection {
|
||
|
|
||
|
private final HashMap<String,MapWithSetWarshipsGeneric<DrawingObjectWarship,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 MapWithSetWarshipsGeneric<>(_pictureWidth,_pictureHeight,map));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void DelMap(String name){
|
||
|
_mapStorages.remove(name);
|
||
|
}
|
||
|
|
||
|
public MapWithSetWarshipsGeneric<DrawingObjectWarship,AbstractMap> get(String name){
|
||
|
if (_mapStorages.containsKey(name)){
|
||
|
return _mapStorages.get(name);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
}
|