Коммит на паре

This commit is contained in:
111 2022-11-22 16:24:33 +04:00 committed by prodigygirl
parent 89342ecb23
commit 748584bfde
4 changed files with 12 additions and 1 deletions

View File

@ -38,7 +38,7 @@ public class FormMapWithArmoredCars extends JFrame{
public FormMapWithArmoredCars() {
super("Карта с набором объектов");
setBounds(100, 100, 1000, 700);
setBounds(100, 100, 1000, 725);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuBar jMenuBar = new JMenuBar();

View File

@ -146,6 +146,10 @@ public class MapWithSetArmoredCarsGeneric<T extends IDrawingObject, U extends Ab
return _setCars;
}
public void removeAllCars() {
_setCars.Clear();
}
public String GetData(char separatorType, char separatorData)
{
String data = String.format("%s%s", _map.getClass().getName(), separatorType);

View File

@ -150,6 +150,9 @@ public class MapsCollection {
map = new MyMapWooden();
break;
}
if (_mapStorages.containsKey(elem[0])) {
_mapStorages.get(elem[0]).removeAllCars();
}
_mapStorages.put(elem[0], new MapWithSetArmoredCarsGeneric<>(_pictureWidth, _pictureHeight, map));
_mapStorages.get(elem[0]).LoadData(elem[2].split(String.valueOf(separatorData)));
} catch (IOException e) {

View File

@ -48,4 +48,8 @@ public class SetArmoredCarsGeneric<T> {
{
return () -> _places.stream().filter(Objects::nonNull).iterator();
}
public void Clear() {
_places.clear();
}
}