From 5db05203223c42575472055d44f6ed7b24f45054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Wed, 16 Nov 2022 11:41:31 +0400 Subject: [PATCH] final final final --- src/MapsCollection.java | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/MapsCollection.java diff --git a/src/MapsCollection.java b/src/MapsCollection.java new file mode 100644 index 0000000..e777182 --- /dev/null +++ b/src/MapsCollection.java @@ -0,0 +1,38 @@ +import java.util.ArrayList; +import java.util.HashMap; + +public class MapsCollection { + private final HashMap> _mapStorages; + private final int _pictureWidth; + private final int _pictureHeight; + + public MapsCollection(int pictureWidth,int pictureHeight){ + _mapStorages=new HashMap<>(); + _pictureWidth=pictureWidth; + _pictureHeight=pictureHeight; + } + + public ArrayList Keys(){ + return new ArrayList<>(_mapStorages.keySet()); + } + + public void AddMap(String name, AbstractMap map){ + if (_mapStorages.containsKey(name)){ + return; + } + else{ + _mapStorages.put(name,new MapWithSetGasolineTankerGeneric<>(_pictureWidth,_pictureHeight,map)); + } + } + + public void DelMap(String name){ + _mapStorages.remove(name); + } + + public MapWithSetGasolineTankerGeneric get(String name){ + if (_mapStorages.containsKey(name)){ + return _mapStorages.get(name); + } + return null; + } +}