From 88eea507fe111801445b1feccc5b405ce3a4f943 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Tue, 24 Oct 2023 12:50:32 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20Pl?= =?UTF-8?q?anesGenericStorage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectStormtrooper/PlanesGenericStorage.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ProjectStormtrooper/PlanesGenericStorage.java diff --git a/ProjectStormtrooper/PlanesGenericStorage.java b/ProjectStormtrooper/PlanesGenericStorage.java new file mode 100644 index 0000000..e015164 --- /dev/null +++ b/ProjectStormtrooper/PlanesGenericStorage.java @@ -0,0 +1,36 @@ +package ProjectStormtrooper; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class PlanesGenericStorage { + final HashMap> _planeStorages; + + public ArrayList Keys() { + return (ArrayList) _planeStorages.keySet().stream().toList(); + } + + private final int _pictureWidth; + private final int _pictureHeight; + + public PlanesGenericStorage(int pictureWidth, int pictureHeight) { + _planeStorages = new HashMap<>(); + _pictureWidth = pictureWidth; + _pictureHeight = pictureHeight; + } + + public void AddSet(String name) { + _planeStorages.put(name, new PlanesGenericCollection<>(_pictureWidth, _pictureHeight)); + } + + public void DelSet(String name) { + _planeStorages.remove(name); + } + + public PlanesGenericCollection Get(String ind) { + if (_planeStorages.containsKey(ind)) + return _planeStorages.get(ind); + return null; + } +}