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