From 05b07c9475fed00bbe7564f0132808c6804cae7c Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Fri, 22 Feb 2019 13:54:25 +0100
Subject: [PATCH] gear rating: implement icomparable

---
 .../SimulationComponent/Impl/GearRating.cs    | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/GearRating.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/GearRating.cs
index eba14be602..8d9ce00efe 100644
--- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/GearRating.cs
+++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/GearRating.cs
@@ -1,4 +1,5 @@
-using TUGraz.VectoCommon.Utils;
+using System;
+using TUGraz.VectoCommon.Utils;
 
 namespace TUGraz.VectoCore.Models.SimulationComponent.Impl {
 
@@ -13,7 +14,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl {
 	}
 
 
-	internal struct GearRating
+	internal struct GearRating : IComparable
 	{
 		private const double CaseSeparationInterval = 1e5;
 
@@ -48,5 +49,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl {
 		{
 			return string.Format("{0} / {1} ({2})", RatingCase, Rating, NumericValue);
 		}
+
+		public int CompareTo(object obj)
+		{
+			var other = (GearRating)obj;
+			if (other > this) {
+				return -1;
+			}
+
+			if (other < this) {
+				return 1;
+			}
+
+			return 0;
+		}
 	}
 }
\ No newline at end of file
-- 
GitLab