From c14bf37bcb8570b3d2090e6fbcedbcce18b098ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D1=84=D1=8C=D1=8F=20=D0=AF=D0=BA=D0=BE=D0=B1?= =?UTF-8?q?=D1=87=D1=83=D0=BA?= Date: Sat, 2 Dec 2023 09:45:01 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B5=D0=B2=20=D0=B4=D0=BB=D1=8F=20SetGeneri?= =?UTF-8?q?c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sailboat/Sailboat/SetGeneric.cs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Sailboat/Sailboat/SetGeneric.cs b/Sailboat/Sailboat/SetGeneric.cs index dd3b9d1..e719d1d 100644 --- a/Sailboat/Sailboat/SetGeneric.cs +++ b/Sailboat/Sailboat/SetGeneric.cs @@ -8,17 +8,37 @@ namespace Sailboat.Generics { internal class SetGeneric where T : class { + /// + /// Массив объектов, которые храним + /// private readonly T?[] _places; + /// + /// Количество объектов в массиве + /// public int Count => _places.Length; + /// + /// Конструктор + /// + /// public SetGeneric(int count) { _places = new T?[count]; } - + /// + /// Добавление объекта в набор + /// + /// Добавляемая лодка + /// public int Insert(T boat) { return Insert(boat, 0); } + /// + /// Добавление объекта в набор на конкретную позицию + /// + /// Добавляемая лодка + /// Позиция + /// public int Insert(T boat, int position) { int nullIndex = -1, i; @@ -50,6 +70,11 @@ namespace Sailboat.Generics _places[position] = boat; return position; } + /// + /// Удаление объекта из набора с конкретной позиции + /// + /// + /// public bool Remove(int position) { if (position < 0 || position >= Count) @@ -60,6 +85,11 @@ namespace Sailboat.Generics _places[position] = null; return true; } + /// + /// Получение объекта из набора по позиции + /// + /// + /// public T? Get(int position) { if (position < 0 || position >= Count)