PIbd-23-Radaev-A.V.-20/Catamaran/CatamaransGenericStorage.cs
Аркадий Радаев a9f980816e res
2023-11-19 12:36:59 +04:00

52 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class CatamaransGenericStorage
{
readonly Dictionary<string, CatamaransGenericCollection<DrawningCatamaran,
DrawningObjectCatamaran>> _catStorages;
public List<string> Keys => _catStorages.Keys.ToList();
private readonly int _pictureWidth;
private readonly int _pictureHeight;
public CatamaransGenericStorage(int pictureWidth, int pictureHeight)
{
_catStorages = new Dictionary<string,
CatamaransGenericCollection<DrawningCatamaran,
DrawningObjectCatamaran>>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
public void AddSet(string name)
{
_catStorages.Add(name, new CatamaransGenericCollection<DrawningCatamaran, DrawningObjectCatamaran>(_pictureWidth, _pictureHeight));
}
public void DelSet(string name)
{
if (!_catStorages.ContainsKey(name))
return;
_catStorages.Remove(name);
}
public CatamaransGenericCollection<DrawningCatamaran, DrawningObjectCatamaran>? this[string ind]
{
get
{
if (_catStorages.ContainsKey(ind))
return _catStorages[ind];
return null;
}
}
}
}