45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
|
|
public class MapsCollection {
|
|
private final HashMap<String,MapWithSetBoatsGeneric<DrawningObjectBoat, AbstractMap>> _mapStorages;
|
|
public ArrayList<String> Keys()
|
|
{
|
|
return new ArrayList<>(_mapStorages.keySet());
|
|
}
|
|
private final int _pictureWidth;
|
|
private final int _pictureHeight;
|
|
public MapsCollection(int pictureWidth,int pictureHeight)
|
|
{
|
|
_mapStorages=new HashMap<>();
|
|
_pictureWidth=pictureWidth;
|
|
_pictureHeight=pictureHeight;
|
|
}
|
|
public void AddMap(String Name, AbstractMap Map)
|
|
{
|
|
if(!_mapStorages.containsKey(Name))
|
|
{
|
|
_mapStorages.put(Name,new MapWithSetBoatsGeneric<>(_pictureWidth,_pictureHeight,Map));
|
|
}
|
|
}
|
|
public void DelMap(String name)
|
|
{
|
|
_mapStorages.remove(name);
|
|
}
|
|
public MapWithSetBoatsGeneric<DrawningObjectBoat,AbstractMap> Get(String ind)
|
|
{
|
|
if(_mapStorages.containsKey(ind))
|
|
{
|
|
return _mapStorages.get(ind);
|
|
}
|
|
return null;
|
|
}
|
|
public DrawningObjectBoat Get(String name, int ind) {
|
|
if (_mapStorages.containsKey(name))
|
|
{
|
|
return _mapStorages.get(name).GetSelectedBoat(ind);
|
|
}
|
|
return null;
|
|
}
|
|
}
|