From 8c6e5da7215e51b11b1ba9e3916bd95d12f78589 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: Tue, 13 Dec 2022 19:30:51 +0400 Subject: [PATCH 1/4] Branch --- src/DrawingObjectGasolineTanker.java | 12 +++++++++ src/ExtentionGasolineTanker.java | 40 ++++++++++++++++++++++++++++ src/IDrawingObject.java | 1 + 3 files changed, 53 insertions(+) create mode 100644 src/ExtentionGasolineTanker.java diff --git a/src/DrawingObjectGasolineTanker.java b/src/DrawingObjectGasolineTanker.java index c637751..53b932c 100644 --- a/src/DrawingObjectGasolineTanker.java +++ b/src/DrawingObjectGasolineTanker.java @@ -36,6 +36,18 @@ public class DrawingObjectGasolineTanker implements IDrawingObject { return _gasolineTanker.GetCurrentPosition(); return null; } + + @Override + public String GetInfo() { + if(_gasolineTanker==null) + return null; + return ExtentionGasolineTanker.GetDataForSave(_gasolineTanker); + } + + public static IDrawingObject Create(String data){ + return new DrawingObjectGasolineTanker(ExtentionGasolineTanker.CreateDrawingWarship(data)); + } + public DrawingGasolineTanker GetGasolineTanker() { return _gasolineTanker; } diff --git a/src/ExtentionGasolineTanker.java b/src/ExtentionGasolineTanker.java new file mode 100644 index 0000000..f1b0cb2 --- /dev/null +++ b/src/ExtentionGasolineTanker.java @@ -0,0 +1,40 @@ +import java.awt.*; + +public class ExtentionGasolineTanker { + private static final char _separatorForObject=':'; + + public static DrawingGasolineTanker CreateDrawingWarship(String info){ + String[] strs = info.split(Character.toString(_separatorForObject)); + + int spd=Integer.parseInt(strs[0]); + float wght = Float.parseFloat(strs[1]); + Color bodyClr=new Color(Integer.parseInt(strs[2])); + IDrawningObjectWheels block = switch(strs[3]) { + case "DrawingWheels" -> new DrawingWheels(Integer.parseInt(strs[4])); + case "DrawingOrnamentWheelsFirst" -> new DrawingOrnamentWheelsFirst(Integer.parseInt(strs[4])); + case "DrawingOrnamentWheelsSecond" -> new DrawingOrnamentWheelsSecond(Integer.parseInt(strs[4])); + default -> null; + }; + if (strs.length==5){ + EntityGasolineTanker ent=new EntityGasolineTanker(spd,wght,bodyClr); + return new DrawingGasolineTanker(ent,block); + } + if(strs.length==9){ + Color dopClr=new Color(Integer.parseInt(strs[5])); + boolean bdkit=Boolean.parseBoolean(strs[6]); + boolean ant=Boolean.parseBoolean(strs[7]); + EntityImprovedGasolineTanker ent = new EntityImprovedGasolineTanker(spd,wght,bodyClr,dopClr,bdkit,ant); + return new DrawingImprovedGasolineTanker(ent,block); + } + return null; + } + + public static String GetDataForSave(DrawingGasolineTanker drawingGasolineTanker){ + var gasolineTanker = drawingGasolineTanker.GasolineTanker; + var str = ""+gasolineTanker.getSpeed()+_separatorForObject+gasolineTanker.getWeight()+_separatorForObject+gasolineTanker.getBodyColor().getRGB()+_separatorForObject+drawingGasolineTanker.getWhees().getClass().getSimpleName()+_separatorForObject+drawingGasolineTanker.GetBlocks().GetCount(); + if(!(gasolineTanker instanceof EntityImprovedGasolineTanker adv)){ + return str; + } + return str+_separatorForObject+adv.GetDopColor().getRGB()+_separatorForObject+adv.GetBodyKit()+_separatorForObject+adv.GetAntena(); + } +} diff --git a/src/IDrawingObject.java b/src/IDrawingObject.java index 3df3eb3..561bb92 100644 --- a/src/IDrawingObject.java +++ b/src/IDrawingObject.java @@ -6,4 +6,5 @@ public interface IDrawingObject { void MoveObject(Direction direction); void DrawingObject(Graphics g); float[] GetCurrentPosition(); + String GetInfo(); } -- 2.25.1 From 906c5ab582fe323dc42d700155529c3d935e1534 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: Tue, 13 Dec 2022 20:39:04 +0400 Subject: [PATCH 2/4] Final --- src/DrawingGasolineTanker.java | 4 +- src/DrawingOrnamentWheelsFirst.java | 6 ++ src/DrawingOrnamentWheelsSecond.java | 6 ++ src/DrawingWheels.java | 5 + src/ExtentionGasolineTanker.java | 4 +- src/FormMapWithSetGasolineTanker.java | 87 +++++++++++++++++- src/IDrawningObjectWheels.java | 1 + src/MapWithSetGasolineTankerGeneric.java | 19 +++- src/MapsCollection.java | 112 +++++++++++++++++++++++ src/SetGasolineTankerGeneric.java | 6 ++ 10 files changed, 245 insertions(+), 5 deletions(-) diff --git a/src/DrawingGasolineTanker.java b/src/DrawingGasolineTanker.java index de22b7c..cfb7564 100644 --- a/src/DrawingGasolineTanker.java +++ b/src/DrawingGasolineTanker.java @@ -43,7 +43,9 @@ public class DrawingGasolineTanker { public void SetBodyColor(Color color){ GasolineTanker= new EntityGasolineTanker(GasolineTanker.getSpeed(), GasolineTanker.getWeight(), color); } - + public IDrawningObjectWheels GetWheels(){ + return Wheels; + } public IDrawningObjectWheels GetFormOfWheels(int FormOfWheel){ OrnamentForm temp = null; for (OrnamentForm form:OrnamentForm.values()) { diff --git a/src/DrawingOrnamentWheelsFirst.java b/src/DrawingOrnamentWheelsFirst.java index cec084f..8dffda3 100644 --- a/src/DrawingOrnamentWheelsFirst.java +++ b/src/DrawingOrnamentWheelsFirst.java @@ -53,5 +53,11 @@ public class DrawingOrnamentWheelsFirst implements IDrawningObjectWheels{ g.drawOval(_startPosX + 30, _startPosY + 45, 20, 5); g.drawOval(_startPosX + 10, _startPosY + 45, 20, 5); } + + } + + @Override + public String GetCount() { + return Integer.toString(_wheels.getCountWheels()); } } diff --git a/src/DrawingOrnamentWheelsSecond.java b/src/DrawingOrnamentWheelsSecond.java index e38d3de..f1d4233 100644 --- a/src/DrawingOrnamentWheelsSecond.java +++ b/src/DrawingOrnamentWheelsSecond.java @@ -54,5 +54,11 @@ public class DrawingOrnamentWheelsSecond implements IDrawningObjectWheels{ g.drawOval(_startPosX + 30, _startPosY + 45, 20, 5); g.drawOval(_startPosX + 10, _startPosY + 45, 20, 5); } + + } + + @Override + public String GetCount() { + return Integer.toString(_wheels.getCountWheels()); } } diff --git a/src/DrawingWheels.java b/src/DrawingWheels.java index e9f272c..61be196 100644 --- a/src/DrawingWheels.java +++ b/src/DrawingWheels.java @@ -42,4 +42,9 @@ public class DrawingWheels implements IDrawningObjectWheels{ g.fillOval(_startPosX + 50, _startPosY + 35, 20, 20); } } + + @Override + public String GetCount() { + return Integer.toString(_wheels.getCountWheels()); + } } diff --git a/src/ExtentionGasolineTanker.java b/src/ExtentionGasolineTanker.java index f1b0cb2..a140b2c 100644 --- a/src/ExtentionGasolineTanker.java +++ b/src/ExtentionGasolineTanker.java @@ -19,7 +19,7 @@ public class ExtentionGasolineTanker { EntityGasolineTanker ent=new EntityGasolineTanker(spd,wght,bodyClr); return new DrawingGasolineTanker(ent,block); } - if(strs.length==9){ + if(strs.length==8){ Color dopClr=new Color(Integer.parseInt(strs[5])); boolean bdkit=Boolean.parseBoolean(strs[6]); boolean ant=Boolean.parseBoolean(strs[7]); @@ -31,7 +31,7 @@ public class ExtentionGasolineTanker { public static String GetDataForSave(DrawingGasolineTanker drawingGasolineTanker){ var gasolineTanker = drawingGasolineTanker.GasolineTanker; - var str = ""+gasolineTanker.getSpeed()+_separatorForObject+gasolineTanker.getWeight()+_separatorForObject+gasolineTanker.getBodyColor().getRGB()+_separatorForObject+drawingGasolineTanker.getWhees().getClass().getSimpleName()+_separatorForObject+drawingGasolineTanker.GetBlocks().GetCount(); + var str = ""+gasolineTanker.getSpeed()+_separatorForObject+gasolineTanker.getWeight()+_separatorForObject+gasolineTanker.getBodyColor().getRGB()+_separatorForObject+drawingGasolineTanker.GetWheels().getClass().getSimpleName()+_separatorForObject+drawingGasolineTanker.GetWheels().GetCount(); if(!(gasolineTanker instanceof EntityImprovedGasolineTanker adv)){ return str; } diff --git a/src/FormMapWithSetGasolineTanker.java b/src/FormMapWithSetGasolineTanker.java index d5ee206..af01c1e 100644 --- a/src/FormMapWithSetGasolineTanker.java +++ b/src/FormMapWithSetGasolineTanker.java @@ -1,6 +1,9 @@ import javax.swing.*; import java.awt.*; import java.util.HashMap; +import java.io.IOException; +import java.util.Optional; +import javax.swing.filechooser.FileNameExtensionFilter; public class FormMapWithSetGasolineTanker extends JFrame{ private JPanel GroupBoxTools; @@ -23,6 +26,7 @@ public class FormMapWithSetGasolineTanker extends JFrame{ private JButton ButtonShowDeleted; private JList ListBoxMaps; private Image bufferedImage; + private JMenuBar MenuBar; private MapsCollection _mapsCollection; private final HashMap _mapsDict=new HashMap(){ @@ -85,6 +89,87 @@ public class FormMapWithSetGasolineTanker extends JFrame{ private void ShowWindow(){ + MenuBar=new JMenuBar(); + + JMenu fileMenu =new JMenu("File"); + MenuBar.add(fileMenu); + + JMenuItem SaveMenuItem = new JMenuItem("Save"); + SaveMenuItem.addActionListener(e -> { + JFileChooser dialog = new JFileChooser(); + dialog.setFileFilter(new FileNameExtensionFilter("txt", "txt")); + dialog.showSaveDialog(this); + + try { + if (_mapsCollection.SaveData(dialog.getSelectedFile().getAbsolutePath())) { + JOptionPane.showMessageDialog(this, "Save was successful", "Outcome", JOptionPane.INFORMATION_MESSAGE); + } else { + JOptionPane.showMessageDialog(this, "\n" + "Not preserved", "Outcome", JOptionPane.ERROR_MESSAGE); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + }); + fileMenu.add(SaveMenuItem); + + JMenuItem LoadMenuItem = new JMenuItem("Load"); + LoadMenuItem.addActionListener(e -> { + JFileChooser dialog = new JFileChooser(); + dialog.setFileFilter(new FileNameExtensionFilter("txt", "txt")); + dialog.showOpenDialog(this); + + try { + if (_mapsCollection.LoadData(dialog.getSelectedFile().getAbsolutePath())) { + ReloadMaps(); + JOptionPane.showMessageDialog(this, "Download successful", "Outcome", JOptionPane.INFORMATION_MESSAGE); + } else { + JOptionPane.showMessageDialog(this, "\n" + "Didn't load", "Outcome", JOptionPane.ERROR_MESSAGE); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + }); + fileMenu.add(LoadMenuItem); + + JMenuItem SaveMapMenuItem = new JMenuItem("Save maps"); + SaveMapMenuItem.addActionListener(e -> { + JFileChooser dialog = new JFileChooser(); + dialog.setFileFilter(new FileNameExtensionFilter("txt", "txt")); + dialog.showSaveDialog(this); + + try { + if (_mapsCollection.SaveMap((String) Optional.ofNullable(ListBoxMaps.getSelectedValue()).orElse(""), dialog.getSelectedFile().getAbsolutePath())) { + JOptionPane.showMessageDialog(this, "\n" + "Save was successful", "Outcome", JOptionPane.INFORMATION_MESSAGE); + } else { + JOptionPane.showMessageDialog(this, "Not preserved", "Outcome", JOptionPane.ERROR_MESSAGE); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + }); + fileMenu.add(SaveMapMenuItem); + + JMenuItem LoadMapMenuItem = new JMenuItem("Load maps"); + LoadMapMenuItem.addActionListener(e -> { + JFileChooser dialog = new JFileChooser(); + dialog.setFileFilter(new FileNameExtensionFilter("txt", "txt")); + dialog.showOpenDialog(this); + + try { + if (_mapsCollection.LoadMap(dialog.getSelectedFile().getAbsolutePath())) { + ReloadMaps(); + JOptionPane.showMessageDialog(this, "Download successful", "Outcome", JOptionPane.INFORMATION_MESSAGE); + } else { + JOptionPane.showMessageDialog(this, "\n" + "Didn't load", "Outcome", JOptionPane.ERROR_MESSAGE); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + }); + fileMenu.add(LoadMapMenuItem); + + setJMenuBar(MenuBar); + ListBoxMaps.addListSelectionListener(e -> { if(ListBoxMaps.getSelectedIndex()==-1) return; @@ -98,7 +183,7 @@ public class FormMapWithSetGasolineTanker extends JFrame{ return; } if(JOptionPane.showConfirmDialog(this,"Delete map "+ListBoxMaps.getSelectedValue().toString()+"?", - "Удаление",JOptionPane.YES_NO_OPTION)==0) + "Removal",JOptionPane.YES_NO_OPTION)==0) { _mapsCollection.DelMap(ListBoxMaps.getSelectedValue().toString()); ReloadMaps(); diff --git a/src/IDrawningObjectWheels.java b/src/IDrawningObjectWheels.java index b293250..91993e7 100644 --- a/src/IDrawningObjectWheels.java +++ b/src/IDrawningObjectWheels.java @@ -3,4 +3,5 @@ import java.awt.*; public interface IDrawningObjectWheels { void SetCountWheels(int count); void DrawWheels(Graphics2D g, int _startPosX, int _startPosY); + String GetCount(); } diff --git a/src/MapWithSetGasolineTankerGeneric.java b/src/MapWithSetGasolineTankerGeneric.java index cf714fd..4a45df9 100644 --- a/src/MapWithSetGasolineTankerGeneric.java +++ b/src/MapWithSetGasolineTankerGeneric.java @@ -7,7 +7,7 @@ public class MapWithSetGasolineTankerGeneric _setGasolineTanker; + public final SetGasolineTankerGeneric _setGasolineTanker; private final ArrayDeque DeletedGasolineTanker; private final U _map; @@ -22,6 +22,9 @@ public class MapWithSetGasolineTankerGeneric (); } + public U GetMap(){ + return _map; + } public int plus(T gasolineTanker) { return _setGasolineTanker.Insert(gasolineTanker); @@ -132,4 +135,18 @@ public class MapWithSetGasolineTankerGeneric =0;i--){ + _setGasolineTanker.Insert((T) DrawingObjectGasolineTanker.Create(records[i])); + } + } } diff --git a/src/MapsCollection.java b/src/MapsCollection.java index e777182..7dfbfcb 100644 --- a/src/MapsCollection.java +++ b/src/MapsCollection.java @@ -1,10 +1,13 @@ import java.util.ArrayList; import java.util.HashMap; +import java.io.*; public class MapsCollection { private final HashMap> _mapStorages; private final int _pictureWidth; private final int _pictureHeight; + private final char separatorDict='|'; + private final char separatorData=';'; public MapsCollection(int pictureWidth,int pictureHeight){ _mapStorages=new HashMap<>(); @@ -35,4 +38,113 @@ public class MapsCollection { } return null; } + @SuppressWarnings("ResultOfMethodCallIgnored") + public boolean SaveData(String filename) throws IOException { + + File file = new File(filename); + + if (file.exists()) + file.delete(); + + file.createNewFile(); + + try (PrintWriter writer = new PrintWriter(file)) { + writer.println("MapsCollection"); + + for (var storage : _mapStorages.entrySet()) { + writer.println(String.format("%s%c%s", storage.getKey(), separatorDict, storage.getValue().GetData(separatorDict, separatorData))); + } + } + return true; + } + + public boolean LoadData(String filename) throws IOException { + + File file = new File(filename); + + if (!file.exists()) + return false; + + try (BufferedReader reader = new BufferedReader(new FileReader(file))) { + String currentLine = reader.readLine(); + + if (currentLine == null || !currentLine.contains("MapsCollection")) + return false; + + _mapStorages.clear(); + + while ((currentLine = reader.readLine()) != null) { + var elements = currentLine.split(String.format("\\%c", separatorDict)); + AbstractMap map = switch (elements[1]) { + case "SimpleMap" -> new SimpleMap(); + case "LongMap" -> new LongMap(); + default -> null; + }; + _mapStorages.put(elements[0], new MapWithSetGasolineTankerGeneric<>(_pictureWidth, _pictureHeight, map)); + _mapStorages.get(elements[0]).LoadData(elements[2].split(separatorData + "\n?")); + } + } + return true; + } + + @SuppressWarnings("ResultOfMethodCallIgnored") + public boolean SaveMap(String mapName, String filename) throws IOException { + File file = new File(filename); + + if (file.exists()) + file.delete(); + + file.createNewFile(); + + MapWithSetGasolineTankerGeneric map = _mapStorages.getOrDefault(mapName, null); + + if (map == null) + return false; + + try (PrintWriter writer = new PrintWriter(file)) { + writer.println("Map"); + writer.println(mapName); + writer.println(map.GetMap().getClass().getSimpleName()); + for (var gasolineTanker : map._setGasolineTanker.GetGasolineTanker()) { + writer.println(gasolineTanker.GetInfo()); + } + } + return true; + } + + public boolean LoadMap(String filename) throws IOException { + File file = new File(filename); + + if (!file.exists()) + return false; + + try (BufferedReader reader = new BufferedReader(new FileReader(file))) { + String currentLine = reader.readLine(); + + if (currentLine == null || !currentLine.contains("Map")) + return false; + + String mapName = reader.readLine(); + + MapWithSetGasolineTankerGeneric map; + if (_mapStorages.containsKey(mapName)) { + map = _mapStorages.get(mapName); + if (!map.GetMap().getClass().getSimpleName().equals(reader.readLine())) { + return false; + } + map._setGasolineTanker.Clear(); + } else { + map = switch (reader.readLine()) { + case "SimpleMap" -> new MapWithSetGasolineTankerGeneric<>(_pictureWidth, _pictureHeight, new SimpleMap()); + case "LongMap" -> new MapWithSetGasolineTankerGeneric<>(_pictureWidth, _pictureHeight, new LongMap()); + default -> null; + }; + } + while ((currentLine = reader.readLine()) != null) { + map._setGasolineTanker.Insert((DrawingObjectGasolineTanker) DrawingObjectGasolineTanker.Create(currentLine)); + } + _mapStorages.put(mapName, map); + } + return true; + } } diff --git a/src/SetGasolineTankerGeneric.java b/src/SetGasolineTankerGeneric.java index 0fb6725..198cab0 100644 --- a/src/SetGasolineTankerGeneric.java +++ b/src/SetGasolineTankerGeneric.java @@ -1,5 +1,6 @@ import java.util.ArrayList; import java.util.Iterator; +import java.util.Objects; public class SetGasolineTankerGeneric implements Iterable{ private final ArrayList _places; public int Count() { @@ -55,4 +56,9 @@ public class SetGasolineTankerGeneric implements Iterable{ public Iterator iterator(){ return _places.iterator(); } + + public Iterable GetGasolineTanker(){ return ()-> _places.stream().filter(Objects::nonNull).iterator();} + public void Clear(){ + _places.clear(); + } } -- 2.25.1 From b126dd006834129f563a4cf2d465ab3440624dee 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: Tue, 13 Dec 2022 20:50:52 +0400 Subject: [PATCH 3/4] fix --- src/DrawingObjectGasolineTanker.java | 2 +- src/ExtentionGasolineTanker.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/DrawingObjectGasolineTanker.java b/src/DrawingObjectGasolineTanker.java index 53b932c..e96315d 100644 --- a/src/DrawingObjectGasolineTanker.java +++ b/src/DrawingObjectGasolineTanker.java @@ -45,7 +45,7 @@ public class DrawingObjectGasolineTanker implements IDrawingObject { } public static IDrawingObject Create(String data){ - return new DrawingObjectGasolineTanker(ExtentionGasolineTanker.CreateDrawingWarship(data)); + return new DrawingObjectGasolineTanker(ExtentionGasolineTanker.CreateDrawingGasolineTanker(data)); } public DrawingGasolineTanker GetGasolineTanker() { diff --git a/src/ExtentionGasolineTanker.java b/src/ExtentionGasolineTanker.java index a140b2c..1baaf0d 100644 --- a/src/ExtentionGasolineTanker.java +++ b/src/ExtentionGasolineTanker.java @@ -3,13 +3,13 @@ import java.awt.*; public class ExtentionGasolineTanker { private static final char _separatorForObject=':'; - public static DrawingGasolineTanker CreateDrawingWarship(String info){ + public static DrawingGasolineTanker CreateDrawingGasolineTanker(String info){ String[] strs = info.split(Character.toString(_separatorForObject)); int spd=Integer.parseInt(strs[0]); float wght = Float.parseFloat(strs[1]); Color bodyClr=new Color(Integer.parseInt(strs[2])); - IDrawningObjectWheels block = switch(strs[3]) { + IDrawningObjectWheels wheels = switch(strs[3]) { case "DrawingWheels" -> new DrawingWheels(Integer.parseInt(strs[4])); case "DrawingOrnamentWheelsFirst" -> new DrawingOrnamentWheelsFirst(Integer.parseInt(strs[4])); case "DrawingOrnamentWheelsSecond" -> new DrawingOrnamentWheelsSecond(Integer.parseInt(strs[4])); @@ -17,14 +17,14 @@ public class ExtentionGasolineTanker { }; if (strs.length==5){ EntityGasolineTanker ent=new EntityGasolineTanker(spd,wght,bodyClr); - return new DrawingGasolineTanker(ent,block); + return new DrawingGasolineTanker(ent,wheels); } if(strs.length==8){ Color dopClr=new Color(Integer.parseInt(strs[5])); boolean bdkit=Boolean.parseBoolean(strs[6]); boolean ant=Boolean.parseBoolean(strs[7]); EntityImprovedGasolineTanker ent = new EntityImprovedGasolineTanker(spd,wght,bodyClr,dopClr,bdkit,ant); - return new DrawingImprovedGasolineTanker(ent,block); + return new DrawingImprovedGasolineTanker(ent,wheels); } return null; } -- 2.25.1 From 0791c5f4f3f755d478c4890a11888ab9a9e9637f 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, 14 Dec 2022 09:50:55 +0400 Subject: [PATCH 4/4] put --- src/MapsCollection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MapsCollection.java b/src/MapsCollection.java index 7dfbfcb..7ce85b4 100644 --- a/src/MapsCollection.java +++ b/src/MapsCollection.java @@ -139,11 +139,11 @@ public class MapsCollection { case "LongMap" -> new MapWithSetGasolineTankerGeneric<>(_pictureWidth, _pictureHeight, new LongMap()); default -> null; }; + _mapStorages.put(mapName, map); } while ((currentLine = reader.readLine()) != null) { map._setGasolineTanker.Insert((DrawingObjectGasolineTanker) DrawingObjectGasolineTanker.Create(currentLine)); } - _mapStorages.put(mapName, map); } return true; } -- 2.25.1