Реализовано сравнение хранилища

This commit is contained in:
Данияр Аглиуллов 2022-11-01 22:07:42 +04:00
parent 5e1f609741
commit 8c6ce67917

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace AirBomber
{
internal class MapWithSetAirplanesGeneric<T, U>
internal class MapWithSetAirplanesGeneric<T, U> : IComparable<MapWithSetAirplanesGeneric<T, U>>
where T : class, IEquatable<T>, IDrawningObject
where U : AbstractMap
{
@ -214,5 +214,18 @@ namespace AirBomber
{
SetAirplanes.SortSet(comparer);
}
public int CompareTo(MapWithSetAirplanesGeneric<T, U>? other)
{
if (other == null)
{
return 1;
}
if (this == other)
{
return 0;
}
return SetAirplanes.Count.CompareTo(other.SetAirplanes.Count);
}
}
}