diff --git a/MapsCollection.java b/MapsCollection.java new file mode 100644 index 0000000..6f040f5 --- /dev/null +++ b/MapsCollection.java @@ -0,0 +1,33 @@ +import java.util.HashMap; +import java.util.Set; + +public class MapsCollection { + private final HashMap> _mapsStorage; + + private final int _pictureWidth; + private final int _pictureHeight; + + public Set getKeys() { + return _mapsStorage.keySet(); + } + + public MapsCollection(int pictureWidth, int pictureHeight) { + _mapsStorage = new HashMap<>(); + _pictureWidth = pictureWidth; + _pictureHeight = pictureHeight; + } + + public void addMap(String name, AbstractMap map) { + if (!_mapsStorage.containsKey(name)) { + _mapsStorage.put(name, new MapWithSetArtilleriesGeneric<>(_pictureWidth, _pictureHeight, map)); + } + } + + public void deleteMap(String name) { + _mapsStorage.remove(name); + } + + public MapWithSetArtilleriesGeneric getMap(String name) { + return _mapsStorage.getOrDefault(name, null); + } +}