import java.util.ArrayList; import java.util.HashMap; public class MapsCollection { final HashMap> _mapStorages; private final int _pictureWidth; private final int _pictureHeight; public ArrayList Keys() { return new ArrayList(_mapStorages.keySet()); } 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 MapWithSetBattleshipsGeneric(_pictureWidth, _pictureHeight, map)); } // TODO Прописать логику для добавления } public void DelMap(String name) { if (_mapStorages.containsKey(name)) { _mapStorages.remove(name); } } public MapWithSetBattleshipsGeneric Get(String ind) { if (_mapStorages.containsKey(ind)) return _mapStorages.get(ind); return null; } public DrawningObjectBattleship Get(String name, int pos) { if (_mapStorages.containsKey(name)) return _mapStorages.get(name)._setBattleship.Get(pos); return null; } }