Мелкие правки 8-й лабораторной.

This commit is contained in:
Programmist73 2022-12-03 20:56:25 +04:00
parent d5f6a04152
commit 519ba5ef7a
2 changed files with 24 additions and 14 deletions

View File

@ -75,7 +75,7 @@ namespace Airbus
return false; return false;
} }
if(plane.CorpusColor != otherPlanePlane.CorpusColor) if (plane.CorpusColor != otherPlanePlane.CorpusColor)
{ {
return false; return false;
} }

View File

@ -43,26 +43,36 @@ namespace Airbus
return 1; return 1;
} }
if(xPlane.GetPlane.Airbus.Speed != yPlane.GetPlane.Airbus.Speed)
{
return 1;
}
if (xPlane.GetPlane.Airbus.Weight != yPlane.GetPlane.Airbus.Weight)
{
return 1;
}
var xEntity = xPlane.GetPlane.Airbus; var xEntity = xPlane.GetPlane.Airbus;
var yEntity = yPlane.GetPlane.Airbus; var yEntity = yPlane.GetPlane.Airbus;
var colorCompare = xEntity.CorpusColor.Name.CompareTo(yEntity.CorpusColor.Name); var colorCompare = xEntity.CorpusColor.ToArgb().CompareTo(yEntity.CorpusColor.ToArgb());
if (colorCompare != 0 || xEntity is not EntitySuperAirbus xEntityAirbus || yEntity is not EntitySuperAirbus yEntityAirbus) int i = xEntity.CorpusColor.ToArgb();
int j = yEntity.CorpusColor.ToArgb();
if (colorCompare != 0)
{ {
return colorCompare; return colorCompare;
} }
return xEntityAirbus.AddColor.Name.CompareTo(yEntityAirbus.AddColor.Name); if (xEntity is EntitySuperAirbus xEntityAirbus && yEntity is EntitySuperAirbus yEntityAirbus)
{
var addColorCompare = xEntityAirbus.AddColor.ToArgb().CompareTo(yEntityAirbus.AddColor.ToArgb());
if(addColorCompare != 0)
{
return addColorCompare;
}
}
var speedCompare = xPlane.GetPlane.Airbus.Speed.CompareTo(yPlane.GetPlane.Airbus.Speed);
if (speedCompare != 0)
{
return speedCompare;
}
return xPlane.GetPlane.Airbus.Weight.CompareTo(yPlane.GetPlane.Airbus.Weight);
} }
} }
} }