using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DumpTruck.DrawingObjects;
using DumpTruck.MovementStrategy;
namespace DumpTruck.Generics
{
///
/// Класс для хранения коллекции
///
internal class TrucksGenericStorage
{
///
/// Словарь (хранилище)
///
readonly Dictionary> _truckStorages;
///
/// Возвращение списка названий наборов
///
public List Keys => _truckStorages.Keys.ToList();
///
/// Ширина окна отрисовки
///
private readonly int _pictureWidth;
///
/// Высота окна отрисовки
///
private readonly int _pictureHeight;
///
/// Конструктор
///
///
///
public TrucksGenericStorage(int pictureWidth, int pictureHeight)
{
_truckStorages = new Dictionary>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
///
/// Добавление набора
///
/// Название набора
public void AddSet(string name)
{
if (!_truckStorages.ContainsKey(name)) _truckStorages.Add(name, new TrucksGenericCollection(_pictureWidth, _pictureHeight));
}
///
/// Удаление набора
///
/// Название набора
public void DelSet(string name)
{
if (_truckStorages.ContainsKey(name)) _truckStorages.Remove(name);
}
///
/// Доступ к набору
///
///
///
public TrucksGenericCollection?
this[string ind]
{
get
{
if (_truckStorages.ContainsKey(ind)) return _truckStorages[ind];
return null;
}
}
}
}