Pibd_13_Fathutdinov_A.I. labWork_08 Simple #9

Closed
gettterot wants to merge 5 commits from labWork_08 into labWork_07
2 changed files with 42 additions and 2 deletions
Showing only changes of commit 5c7b6d8bf2 - Show all commits

View File

@ -60,9 +60,9 @@ namespace ProjectLiner.CollectionGenericObjects
/// <param name="company">Компания</param>
/// <param name="airplane">Добавляемый объект</param>
/// <returns></returns>
public static int operator +(AbstractCompany company, DrawningCommonLiner airplane)
public static int operator +(AbstractCompany company, DrawningCommonLiner liner)
{
return company._collection.Insert(airplane);
return company._collection.Insert(liner, new DrawningLinerEqutables() );
}
/// <summary>

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectLiner.Drawnings;
/// <summary>
/// Сравнение по типу, скорости, весу
/// </summary>
public class DrawningLinerCompareByType : IComparer<DrawningCommonLiner?>
{
public int Compare(DrawningCommonLiner? x, DrawningCommonLiner? y)
{
if (x == null && y == null) return 0;
if (x == null || x.EntityCommonLiner == null)
{
return 1;
}
if (y == null || y.EntityCommonLiner == null)
{
return -1;
}
if (x.GetType().Name != y.GetType().Name)
{
return x.GetType().Name.CompareTo(y.GetType().Name);
}
var speedCompare = x.EntityCommonLiner.Speed.CompareTo(y.EntityCommonLiner.Speed);
if (speedCompare != 0)
{
return speedCompare;
}
return x.EntityCommonLiner.Weight.CompareTo(y.EntityCommonLiner.Weight);
}
}