ISEbd-12_Paramonova_I.A._LabWork08_Simple #22
@ -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>
|
||||
|
@ -59,5 +59,9 @@ public interface ICollectionGenericObjects<T>
|
||||
/// <returns>Поэлементый вывод элементов коллекции</returns>
|
||||
IEnumerable<T?> GetItems();
|
||||
|
||||
/// <summary>
|
||||
/// Сортировка коллекции
|
||||
/// </summary>
|
||||
/// <param name="comparer">Сравнитель объектов</param>
|
||||
void CollectionSort(IComparer<T?> comparer);
|
||||
}
|
29
AirFighter/AirFighter/Entities/EntityMilitaryAircraf.cs
Normal file
29
AirFighter/AirFighter/Entities/EntityMilitaryAircraf.cs
Normal 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;
|
||||
}
|
||||
}
|
@ -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)
|
||||
|
@ -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;
|
Loading…
Reference in New Issue
Block a user