49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
|
import java.util.AbstractCollection;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.HashMap;
|
||
|
|
||
|
public class MapsCollection {
|
||
|
private final HashMap<String,MapWithSetShipGeneric<DrawningObjectShip, 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<>();
|
||
|
this._pictureWidth = pictureWidth;
|
||
|
this._pictureHeight = pictureHeight;
|
||
|
}
|
||
|
|
||
|
public void AddMap(String Name, AbstractMap Map)
|
||
|
{
|
||
|
if(!_mapStorages.containsKey(Name))
|
||
|
{
|
||
|
_mapStorages.put(Name,new MapWithSetShipGeneric<>(_pictureWidth,_pictureHeight,Map));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void DelMap(String name)
|
||
|
{
|
||
|
_mapStorages.remove(name);
|
||
|
}
|
||
|
|
||
|
public MapWithSetShipGeneric<DrawningObjectShip,AbstractMap> Get(String ind)
|
||
|
{
|
||
|
if(_mapStorages.containsKey(ind))
|
||
|
{
|
||
|
return _mapStorages.get(ind);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public DrawningObjectShip Get(String name, int ind)
|
||
|
{
|
||
|
if (_mapStorages.containsKey(name)) return _mapStorages.get(name).GetSelectedShip(ind);
|
||
|
return null;
|
||
|
}
|
||
|
}
|