Second stage: Completed
This commit is contained in:
parent
0ae6527361
commit
e2f76ef916
33
MapsCollection.java
Normal file
33
MapsCollection.java
Normal file
@ -0,0 +1,33 @@
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
public class MapsCollection {
|
||||
private final HashMap<String, MapWithSetArtilleriesGeneric<DrawingObjectArtillery, AbstractMap>> _mapsStorage;
|
||||
|
||||
private final int _pictureWidth;
|
||||
private final int _pictureHeight;
|
||||
|
||||
public Set<String> 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<DrawingObjectArtillery, AbstractMap> getMap(String name) {
|
||||
return _mapsStorage.getOrDefault(name, null);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user