diff --git a/SelfPropelledArtilleryUnit/Generics/SPAUGenericStorage.java b/SelfPropelledArtilleryUnit/Generics/SPAUGenericStorage.java new file mode 100644 index 0000000..b1e1895 --- /dev/null +++ b/SelfPropelledArtilleryUnit/Generics/SPAUGenericStorage.java @@ -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> 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 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 get(String ind) { + return SPAUStorages.get(ind); + } +} diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit.java b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit.java index e57b07b..aaaadc4 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit.java +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit.java @@ -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); });