From e4baa6c1f05bce11b1b7f9e4a34087fd2bdc9d90 Mon Sep 17 00:00:00 2001
From: Kirill <117719052+KirillFirsof@users.noreply.github.com>
Date: Thu, 7 Dec 2023 14:14:15 +0400
Subject: [PATCH] s godom
---
.../TractorsGenericStorage.cs | 81 +++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs
diff --git a/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs
new file mode 100644
index 0000000..14ed5b5
--- /dev/null
+++ b/RPP_FirstLaba_Tractor/RPP_FirstLaba_Tractor/TractorsGenericStorage.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ProjectTractor.DrawningObjects;
+using ProjectTractor.MovementStrategy;
+using ProjectTractor.Generics;
+
+namespace ProjectTractor
+{
+ ///
+ /// Класс для хранения коллекции
+ ///
+ internal class TractorsGenericStorage
+ {
+ ///
+ /// Словарь (хранилище)
+ ///
+ readonly Dictionary> _tractorStorages;
+ ///
+ /// Возвращение списка названий наборов
+ ///
+ public List Keys => _tractorStorages.Keys.ToList();
+ ///
+ /// Ширина окна отрисовки
+ ///
+ private readonly int _pictureWidth;
+ ///
+ /// Высота окна отрисовки
+ ///
+ private readonly int _pictureHeight;
+ ///
+ /// Конструктор
+ ///
+ ///
+ ///
+ public TractorsGenericStorage(int pictureWidth, int pictureHeight)
+ {
+ _tractorStorages = new Dictionary>();
+ _pictureWidth = pictureWidth;
+ _pictureHeight = pictureHeight;
+ }
+ ///
+ /// Добавление набора
+ ///
+ /// Название набора
+ public void AddSet(string name)
+ {
+ _tractorStorages.Add(name,
+ new TractorsGenericCollection(_pictureWidth, _pictureHeight));
+ }
+ ///
+ /// Удаление набора
+ ///
+ /// Название набора
+ public void DelSet(string name)
+ {
+ if (!_tractorStorages.ContainsKey(name))
+ return;
+ _tractorStorages.Remove(name);
+ }
+ ///
+ /// Доступ к набору
+ ///
+ ///
+ ///
+ public TractorsGenericCollection?
+ this[string ind]
+ {
+ get
+ {
+ if (_tractorStorages.ContainsKey(ind))
+ return _tractorStorages[ind];
+ return null;
+ }
+ }
+ }
+}