From 58521edbd2e45b77dc27fe5cb290da748d8c355b Mon Sep 17 00:00:00 2001 From: ekallin Date: Tue, 19 Dec 2023 14:25:00 +0400 Subject: [PATCH] ready lab 8 for pul request --- .../ProjectElectricLocomotive/LocoCompareByColor.cs | 12 ++++++++---- .../LocomotiveGenericStorage.cs | 3 +-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/LocoCompareByColor.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/LocoCompareByColor.cs index e27ae5c..87671b9 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/LocoCompareByColor.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/LocoCompareByColor.cs @@ -15,15 +15,19 @@ namespace ProjectElectricLocomotive if (x == null || x.EntityLocomotive == null) throw new NotImplementedException(nameof(x)); + if (y == null || y.EntityLocomotive == null) throw new NotImplementedException(nameof(y)); + var bodyColor = x.EntityLocomotive.BodyColor.Name.CompareTo(y.EntityLocomotive.BodyColor.Name); + if (bodyColor != 0) return bodyColor; - if(x.EntityLocomotive is EntityElectricLocomotive xEntityElectricLocomotive && - y.EntityLocomotive is EntityElectricLocomotive yEntityElectricLocomotive) + + if(x.EntityLocomotive is EntityElectricLocomotive && + y.EntityLocomotive is EntityElectricLocomotive) { - var addcolor = (x.EntityLocomotive as EntityElectricLocomotive).AdditionalColor.Name.CompareTo( - (y.EntityLocomotive as EntityElectricLocomotive).AdditionalColor.Name); + var addcolor = (x.EntityLocomotive as EntityElectricLocomotive).AdditionalColor.Name.CompareTo((y.EntityLocomotive + as EntityElectricLocomotive).AdditionalColor.Name); if(addcolor != 0) return addcolor; } return 1; diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/LocomotiveGenericStorage.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/LocomotiveGenericStorage.cs index b55136c..28a9d2e 100644 --- a/ProjectElectricLocomotive/ProjectElectricLocomotive/LocomotiveGenericStorage.cs +++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/LocomotiveGenericStorage.cs @@ -9,9 +9,8 @@ using ProjectElectricLocomotive.MovementStrategy; namespace ProjectElectricLocomotive.Generics { - internal class LocomotiveGenericStorage + internal class LocomotiveGenericStorage { - //create lab 7 /// /// Словарь (хранилище)