Eliseev E.E. LabWork08 #9

Closed
ElEgEv wants to merge 8 commits from LabWork08 into LabWork07
4 changed files with 16 additions and 15 deletions
Showing only changes of commit acba9f2071 - Show all commits

View File

@ -80,7 +80,12 @@ namespace Airbus
return false;
}
if(plane is EntitySuperAirbus entitySuperAirbus && otherPlanePlane is EntitySuperAirbus otherEntitySuperAirbus)
if(plane.GetType().Name != otherPlanePlane.GetType().Name)
{
return false;
}
if (plane is EntitySuperAirbus entitySuperAirbus && otherPlanePlane is EntitySuperAirbus otherEntitySuperAirbus)
{
if(entitySuperAirbus.AddEngine != otherEntitySuperAirbus.AddEngine)
{
@ -92,7 +97,7 @@ namespace Airbus
return false;
}
if(entitySuperAirbus.AddColor.ToArgb() != otherEntitySuperAirbus.AddColor.ToArgb())
if(entitySuperAirbus.AddColor.Name != otherEntitySuperAirbus.AddColor.Name)
{
return false;
}

View File

@ -45,14 +45,14 @@ namespace Airbus
var xEntity = xPlane.GetPlane.Airbus;
var yEntity = yPlane.GetPlane.Airbus;
var colorCompare = xEntity.CorpusColor.ToArgb().CompareTo(yEntity.CorpusColor.ToArgb());
var colorCompare = xEntity.CorpusColor.Name.CompareTo(yEntity.CorpusColor.Name);
if (colorCompare != 0 || xEntity is not EntitySuperAirbus xEntityAirbus || yEntity is not EntitySuperAirbus yEntityAirbus)
{
return colorCompare;
}
return xEntityAirbus.AddColor.ToArgb().CompareTo(yEntityAirbus.AddColor.ToArgb());
return xEntityAirbus.AddColor.Name.CompareTo(yEntityAirbus.AddColor.Name);
}
}
}

View File

@ -1,2 +1,2 @@
MapsCollection
123|StarWarsMap|1000:750:Red;1000:750:DeepPink:Control:False:False;
345|DesertStormMap|1000:750:Black:Yellow:False:True;1010:760:Yellow;1005:755:Lime;

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Reflection.PortableExecutable;
using System.Text;
using System.Threading.Tasks;
@ -29,11 +30,6 @@ namespace Airbus
//добавление объекта в набор
public int Insert(T plane)
{
if (_places.Contains(plane))
{
throw new ArgumentException($"Объект {plane} уже есть в данном наборе");
}
if (Count == _maxCount)
{
throw new StorageOverflowException(_maxCount);
@ -47,16 +43,16 @@ namespace Airbus
//добавление объекта в набор на конкретную позицию
public int Insert(T plane, int position)
{
if (position > _maxCount && position < 0)
{
return -1;
}
if (_places.Contains(plane))
{
throw new ArgumentException($"Объект {plane} уже есть в наборе");
}
if (position > _maxCount && position < 0)
{
return -1;
}
_places.Insert(position, plane);
return position;