ISEbd-12_Paramonova_I.A._LabWork08_Simple #22

Closed
ikswi wants to merge 2 commits from LabWork08.1 into LabWork07.1
5 changed files with 41 additions and 2 deletions
Showing only changes of commit 48d0a47fcc - Show all commits

View File

@ -114,6 +114,10 @@ public abstract class AbstractCompany
return bitmap;
}
/// <summary>
/// Сортировка
/// </summary>
/// <param name="comparer">Сравнитель объектов</param>
public void Sort(IComparer<DrawningMilitaryAircraft?> comparer) => _collection?.CollectionSort(comparer);
/// <summary>

View File

@ -59,5 +59,9 @@ public interface ICollectionGenericObjects<T>
/// <returns>Поэлементый вывод элементов коллекции</returns>
IEnumerable<T?> GetItems();
/// <summary>
/// Сортировка коллекции
/// </summary>
/// <param name="comparer">Сравнитель объектов</param>
void CollectionSort(IComparer<T?> comparer);
}

View File

@ -0,0 +1,29 @@
namespace ProjectAirFighter.Entities;
/// <summary>
/// Класс-сущность "Истребитель"
/// </summary>
public class EntityMilitaryAircraf
{
public int Speed { get; private set; }
public double Weight { get; private set; }
public Color BodyColor { get; private set; }
public double Step => Speed * 100 / Weight;
/// <summary>
/// Конструктор сущности
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Основной цвет</param>
public EntityMilitaryAircraf (int speed, double weight, Color bodyColor)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
}
}

View File

@ -302,6 +302,10 @@ public partial class FormMilitaryAircraftCollection : Form
CompareMilitaryAircraft(new DrawningMilitaryAircraftCompareByColor());
}
/// <summary>
/// Сортировка по сравнителю
/// </summary>
/// <param name="comparer">Сравнитель объектов</param>
private void CompareMilitaryAircraft(IComparer<DrawningMilitaryAircraft?> comparer)
{
if (_company == null)

View File

@ -1,2 +0,0 @@
CollectionsStorage
12-Massive-|52|EntityMilitaryAircraft:100:100:Black;EntityAirFighter:100:100:White:False:True:BlueViolet;EntityMilitaryAircraft:100:100:Green;EntityAirFighter:100:100:Blue:True:True:Black;