diff --git a/Trolleybus/Trolleybus/FormTrolleybus.cs b/Trolleybus/Trolleybus/FormTrolleybus.cs index a1f8bb0..f3fcf81 100644 --- a/Trolleybus/Trolleybus/FormTrolleybus.cs +++ b/Trolleybus/Trolleybus/FormTrolleybus.cs @@ -9,7 +9,6 @@ namespace ProjectTrolleybus private AbstractStrategy? _strategy; public DrawingBus? SelectedBus { get; private set; } - public FormTrolleybus() { InitializeComponent(); diff --git a/Trolleybus/Trolleybus/SetGeneric.cs b/Trolleybus/Trolleybus/SetGeneric.cs index 73af66c..815d1e9 100644 --- a/Trolleybus/Trolleybus/SetGeneric.cs +++ b/Trolleybus/Trolleybus/SetGeneric.cs @@ -9,39 +9,22 @@ namespace ProjectTrolleybus.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 bool Insert(T trolleybus) { if (_places[Count - 1] != null) return false; return Insert(trolleybus, 0);/// } - /// - /// Добавление объекта в набор на конкретную позицию - /// - /// Добавляемый автомобиль - /// Позиция - /// + public bool Insert(T trolleybus, int position) { if (!(position >= 0 && position < Count)) @@ -59,11 +42,7 @@ namespace ProjectTrolleybus.Generics _places[position] = trolleybus; return true; } - /// - /// Удаление объекта из набора с конкретной позиции - /// - /// - /// + public bool Remove(int position) { if (!(position >= 0 && position < Count) || _places[position] == null) @@ -71,11 +50,7 @@ namespace ProjectTrolleybus.Generics _places[position] = null; return true; } - /// - /// Получение объекта из набора по позиции - /// - /// - /// + public T? Get(int position) { if (!(position >= 0 && position < Count))