diff --git a/AirFighter/AirFighter/CollectionGenericObjects/AbstractCompany.cs b/AirFighter/AirFighter/CollectionGenericObjects/AbstractCompany.cs index 1e3b8f4..4a4727b 100644 --- a/AirFighter/AirFighter/CollectionGenericObjects/AbstractCompany.cs +++ b/AirFighter/AirFighter/CollectionGenericObjects/AbstractCompany.cs @@ -114,6 +114,10 @@ public abstract class AbstractCompany return bitmap; } + /// + /// Сортировка + /// + /// Сравнитель объектов public void Sort(IComparer comparer) => _collection?.CollectionSort(comparer); /// diff --git a/AirFighter/AirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs b/AirFighter/AirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs index e673913..e55afb2 100644 --- a/AirFighter/AirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs +++ b/AirFighter/AirFighter/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -59,5 +59,9 @@ public interface ICollectionGenericObjects /// Поэлементый вывод элементов коллекции IEnumerable GetItems(); + /// + /// Сортировка коллекции + /// + /// Сравнитель объектов void CollectionSort(IComparer comparer); } \ No newline at end of file diff --git a/AirFighter/AirFighter/Entities/EntityMilitaryAircraf.cs b/AirFighter/AirFighter/Entities/EntityMilitaryAircraf.cs new file mode 100644 index 0000000..0773701 --- /dev/null +++ b/AirFighter/AirFighter/Entities/EntityMilitaryAircraf.cs @@ -0,0 +1,29 @@ +namespace ProjectAirFighter.Entities; + +/// +/// Класс-сущность "Истребитель" +/// +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; + + /// + /// Конструктор сущности + /// + /// Скорость + /// Вес автомобиля + /// Основной цвет + + public EntityMilitaryAircraf (int speed, double weight, Color bodyColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + } +} diff --git a/AirFighter/AirFighter/FormMilitaryAircraftCollection.cs b/AirFighter/AirFighter/FormMilitaryAircraftCollection.cs index 27623b5..5ecfb05 100644 --- a/AirFighter/AirFighter/FormMilitaryAircraftCollection.cs +++ b/AirFighter/AirFighter/FormMilitaryAircraftCollection.cs @@ -302,6 +302,10 @@ public partial class FormMilitaryAircraftCollection : Form CompareMilitaryAircraft(new DrawningMilitaryAircraftCompareByColor()); } + /// + /// Сортировка по сравнителю + /// + /// Сравнитель объектов private void CompareMilitaryAircraft(IComparer comparer) { if (_company == null) diff --git a/тренировочный.txt b/тренировочный.txt deleted file mode 100644 index b385ee4..0000000 --- a/тренировочный.txt +++ /dev/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; \ No newline at end of file