This commit is contained in:
GokaPek 2023-12-19 22:12:42 +04:00
parent 4892fb36de
commit a289c89c8b
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,37 @@
package SelfPropelledArtilleryUnit.Generics;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import SelfPropelledArtilleryUnit.DrawningObjects.DrawningSPAU;
import SelfPropelledArtilleryUnit.MovementStrategy.DrawningObjectSPAU;
public class SPAUGenericStorage {
private final Map<String, SPAUGenericCollection<DrawningSPAU, DrawningObjectSPAU>> SPAUStorages;
private final int pictureWidth;
private final int pictureHeight;
public SPAUGenericStorage(int pictureWidth, int pictureHeight) {
this.SPAUStorages = new HashMap<>();
this.pictureWidth = pictureWidth;
this.pictureHeight = pictureHeight;
}
public List<String> getKeys() {
return new ArrayList<>(SPAUStorages.keySet());
}
public void addSet(String name) {
SPAUStorages.put(name, new SPAUGenericCollection<>(pictureWidth, pictureHeight));
}
public void delSet(String name) {
SPAUStorages.remove(name);
}
public SPAUGenericCollection<DrawningSPAU, DrawningObjectSPAU> get(String ind) {
return SPAUStorages.get(ind);
}
}

View File

@ -5,7 +5,6 @@ public class SelfPropelledArtilleryUnit {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
FormSPAUCollection form = new FormSPAUCollection();
FormHard formHard = new FormHard();
form.setSize(900, 500);
form.setVisible(true);
});