From 990656077f783e38262791d31e410c5c682b2190 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Thu, 14 Apr 2022 14:10:22 +0200 Subject: [PATCH] code formatting --- .../Impl/HybridController.cs | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs index 7539896f58..0cbdfc9083 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs @@ -436,18 +436,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } - protected virtual bool SpeedTooLowForEngine(GearshiftPosition gear, PerSecond outAngularSpeed) - { - return (outAngularSpeed * GearboxModelData.Gears[gear.Gear].Ratio).IsSmaller(DataBus.EngineInfo.EngineIdleSpeed); - } + protected virtual bool SpeedTooLowForEngine(GearshiftPosition gear, PerSecond outAngularSpeed) => + (outAngularSpeed * GearboxModelData.Gears[gear.Gear].Ratio).IsSmaller(DataBus.EngineInfo.EngineIdleSpeed); - protected virtual bool SpeedTooHighForEngine(GearshiftPosition gear, PerSecond outAngularSpeed) - { - return - (outAngularSpeed * GearboxModelData.Gears[gear.Gear].Ratio).IsGreaterOrEqual(VectoMath.Min( - GearboxModelData.Gears[gear.Gear].MaxSpeed, - DataBus.EngineInfo.EngineN95hSpeed)); - } + protected virtual bool SpeedTooHighForEngine(GearshiftPosition gear, PerSecond outAngularSpeed) => + (outAngularSpeed * GearboxModelData.Gears[gear.Gear].Ratio).IsGreaterOrEqual( + VectoMath.Min(GearboxModelData.Gears[gear.Gear].MaxSpeed, DataBus.EngineInfo.EngineN95hSpeed)); public override GearshiftPosition Engage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity) { @@ -492,23 +486,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public override IGearbox Gearbox { get => _gearbox; - set { - var myGearbox = value as Gearbox; - if (myGearbox == null) { - throw new VectoException("This shift strategy can't handle gearbox of type {0}", - value.GetType()); - } - - _gearbox = myGearbox; - } + set => _gearbox = value as Gearbox ?? throw new VectoException("This shift strategy can't handle gearbox of type {0}", value.GetType()); } public override GearshiftPosition NextGear => _nextGear; - public void SetNextGear(GearshiftPosition nextGear) - { - _nextGear = nextGear; - } + public void SetNextGear(GearshiftPosition nextGear) => _nextGear = nextGear; } -- GitLab