using Lab.DrawningObjects; using Lab.MovementStrategy; using Lab.Generics; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Lab { internal class CarsGenericStorage { readonly Dictionary> _carStorages; public List Keys => _carStorages.Keys.ToList(); private readonly int _pictureWidth; private readonly int _pictureHeight; public CarsGenericStorage(int pictureWidth, int pictureHeight) { _carStorages = new Dictionary>(); _pictureWidth = pictureWidth; _pictureHeight = pictureHeight; } public void AddSet(string name) { if (_carStorages.ContainsKey(name)) return; _carStorages[name] = new CarsGenericCollection(_pictureWidth, _pictureHeight); } public void DelSet(string name) { if (!_carStorages.ContainsKey(name)) return; _carStorages.Remove(name); } public CarsGenericCollection? this[string ind] { get { if (_carStorages.ContainsKey(ind)) return _carStorages[ind]; return null; } } } }