add rewrite

This commit is contained in:
DozorovaA.A 2022-12-03 15:32:22 +04:00
parent 5063d4d157
commit 4e206defed
4 changed files with 11 additions and 2 deletions

Binary file not shown.

View File

@ -24,7 +24,9 @@ public class MapWithSetMachineGeneric<T extends IDrawingObject, U extends Abstra
_pictureHeight = picHeight;
_map = map;
}
public void Clear() {
_setCars.Clear();
}
public int add(T car)
{
return _setCars.Insert(car);

View File

@ -218,6 +218,9 @@ public class MapsCollection {
break;
}
_mapStorages.put(elem[0], new MapWithSetMachineGeneric<IDrawingObject, AbstractMap>(_pictureWidth, _pictureHeight, map));
if(_mapStorages.containsKey(elem[0])){
_mapStorages.get(elem[0]).Clear();
}
while((str = br.readLine()) != null) {
_mapStorages.get(elem[0]).LoadData(str.split(separatorData + "\n?"));
}

View File

@ -13,7 +13,11 @@ public class SetArmoredCarsGeneric<T> implements Iterable<T>{
public int getCount() {
return _places.isEmpty() ? 0 : _places.size();
}
public void Clear() {
_places.clear();
}
public int Insert(T armoredCar)
{
if(_places.size()+1 <= _MaxCount) return Insert(armoredCar, 0);