47 lines
1.2 KiB
Java
47 lines
1.2 KiB
Java
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class CarsGenericStorage {
|
|
final HashMap<String, CarsGenericCollection<DrawTanker, DrawingObjectTanker>> _carStorages;
|
|
public ArrayList<String> Keys()
|
|
{
|
|
return new ArrayList<>(_carStorages.keySet());
|
|
}
|
|
private final int _pictureWidth;
|
|
private final int _pictureHeight;
|
|
public CarsGenericStorage(int pictureWidth, int pictureHeight)
|
|
{
|
|
_pictureHeight = pictureHeight;
|
|
_pictureWidth = pictureWidth;
|
|
_carStorages = new HashMap<>();
|
|
}
|
|
public void AddSet(String name)
|
|
{
|
|
if (Keys().contains(name))
|
|
return;
|
|
_carStorages.put(name, new CarsGenericCollection<>(_pictureWidth, _pictureHeight));
|
|
}
|
|
public void DelSet(String name)
|
|
{
|
|
if (!Keys().contains(name))
|
|
return;
|
|
_carStorages.remove(name);
|
|
}
|
|
|
|
public CarsGenericCollection<DrawTanker, DrawingObjectTanker> get(String ind)
|
|
{
|
|
if (Keys().contains(ind))
|
|
return _carStorages.get(ind);
|
|
return null;
|
|
}
|
|
public DrawingObjectTanker get(String name, int ind)
|
|
{
|
|
if (!Keys().contains(name))
|
|
return null;
|
|
return _carStorages.get(name).GetU(ind);
|
|
}
|
|
|
|
|
|
|
|
}
|