From 986fb19a916491bd5981bc6325b4341f2d6db4a2 Mon Sep 17 00:00:00 2001
From: Markus Quaritsch <markus.quaritsch@tugraz.at>
Date: Mon, 23 Mar 2015 15:28:50 +0100
Subject: [PATCH] renaming extensionMethod

---
 .../Models/Simulation/Data/EngineOnlyDrivingCycle.cs      | 8 ++++----
 VectoCore/Models/Simulation/Data/ModalResult.cs           | 2 +-
 .../SimulationComponent/Data/Engine/FuelConsumptionMap.cs | 6 +++---
 .../SimulationComponent/Data/Engine/FullLoadCurve.cs      | 8 ++++----
 VectoCore/Utils/DataRowExtensionMethods.cs                | 2 +-
 VectoCoreTest/Utils/TestModalDataWriter.cs                | 7 +++++++
 VectoCoreTest/VectoCoreTest.csproj                        | 1 +
 7 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/VectoCore/Models/Simulation/Data/EngineOnlyDrivingCycle.cs b/VectoCore/Models/Simulation/Data/EngineOnlyDrivingCycle.cs
index 08a84f0bcc..ac240589b0 100644
--- a/VectoCore/Models/Simulation/Data/EngineOnlyDrivingCycle.cs
+++ b/VectoCore/Models/Simulation/Data/EngineOnlyDrivingCycle.cs
@@ -64,15 +64,15 @@ namespace TUGraz.VectoCore.Models.Simulation.Data
             foreach (DataRow row in data.Rows)
             {
                 var cycle = new EngineOnlyDrivingCycle();
-                cycle.EngineSpeed = row.GetDouble(Fields.EngineSpeed);
+                cycle.EngineSpeed = row.ParseDouble(Fields.EngineSpeed);
 
                 if (data.Columns.Contains(Fields.PowerEngine))
-                    cycle.PowerEngine = row.GetDouble(Fields.PowerEngine);
+                    cycle.PowerEngine = row.ParseDouble(Fields.PowerEngine);
                 else
-                    cycle.Torque = row.GetDouble(Fields.Torque);
+                    cycle.Torque = row.ParseDouble(Fields.Torque);
 
                 if (data.Columns.Contains(Fields.PowerAuxilaries))
-                    cycle.PowerAuxilaries = row.GetDouble(Fields.PowerAuxilaries);
+                    cycle.PowerAuxilaries = row.ParseDouble(Fields.PowerAuxilaries);
 
                 cycles.Add(cycle);
             }
diff --git a/VectoCore/Models/Simulation/Data/ModalResult.cs b/VectoCore/Models/Simulation/Data/ModalResult.cs
index 52a58ac50b..c31b98d85e 100644
--- a/VectoCore/Models/Simulation/Data/ModalResult.cs
+++ b/VectoCore/Models/Simulation/Data/ModalResult.cs
@@ -37,7 +37,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Data
                     if (col.ColumnName == ModalResultField.FC.GetName() && row.Field<string>(col) == "ERROR")
                         continue;
 
-                    newRow.SetField(col.ColumnName, row.GetDouble(col.ColumnName));
+                    newRow.SetField(col.ColumnName, row.ParseDouble(col.ColumnName));
 
                 }
                 modalResults.Rows.Add(newRow);
diff --git a/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMap.cs b/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMap.cs
index eb04a00179..5b67799e49 100644
--- a/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMap.cs
+++ b/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMap.cs
@@ -80,9 +80,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine
                     {
                         var entry = new FuelConsumptionEntry
                         {
-                            EngineSpeed = row.GetDouble(Fields.EngineSpeed),
-                            Torque = row.GetDouble(Fields.Torque),
-                            FuelConsumption = row.GetDouble(Fields.FuelConsumption)
+                            EngineSpeed = row.ParseDouble(Fields.EngineSpeed),
+                            Torque = row.ParseDouble(Fields.Torque),
+                            FuelConsumption = row.ParseDouble(Fields.FuelConsumption)
                         };
 
                         if (entry.FuelConsumption < 0)
diff --git a/VectoCore/Models/SimulationComponent/Data/Engine/FullLoadCurve.cs b/VectoCore/Models/SimulationComponent/Data/Engine/FullLoadCurve.cs
index 62d20122f2..04c2ab2fa2 100644
--- a/VectoCore/Models/SimulationComponent/Data/Engine/FullLoadCurve.cs
+++ b/VectoCore/Models/SimulationComponent/Data/Engine/FullLoadCurve.cs
@@ -81,10 +81,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine
             {
                 var entry = new FullLoadCurveEntry
                 {
-                    EngineSpeed = row.GetDouble(Fields.EngineSpeed),
-                    TorqueFullLoad = row.GetDouble(Fields.TorqueFullLoad),
-                    TorqueDrag = row.GetDouble(Fields.TorqueDrag),
-                    PT1 = row.GetDouble(Fields.PT1)
+                    EngineSpeed = row.ParseDouble(Fields.EngineSpeed),
+                    TorqueFullLoad = row.ParseDouble(Fields.TorqueFullLoad),
+                    TorqueDrag = row.ParseDouble(Fields.TorqueDrag),
+                    PT1 = row.ParseDouble(Fields.PT1)
                 };
                 fullLoadCurve._entries.Add(entry);
             }
diff --git a/VectoCore/Utils/DataRowExtensionMethods.cs b/VectoCore/Utils/DataRowExtensionMethods.cs
index 37d8976e8c..601d5c2d1d 100644
--- a/VectoCore/Utils/DataRowExtensionMethods.cs
+++ b/VectoCore/Utils/DataRowExtensionMethods.cs
@@ -13,7 +13,7 @@ namespace TUGraz.VectoCore.Utils
         /// <param name="row"></param>
         /// <param name="columnName">The name of the column.</param>
         /// <returns>The value of the underlying DataRows column field as double.</returns>
-        public static double GetDouble(this DataRow row, string columnName, CultureInfo culture = null)
+        public static double ParseDouble(this DataRow row, string columnName, CultureInfo culture = null)
         {
             //todo ArgumentNullException?
             try
diff --git a/VectoCoreTest/Utils/TestModalDataWriter.cs b/VectoCoreTest/Utils/TestModalDataWriter.cs
index 4718d6e2e9..e0eaa13a6c 100644
--- a/VectoCoreTest/Utils/TestModalDataWriter.cs
+++ b/VectoCoreTest/Utils/TestModalDataWriter.cs
@@ -1,5 +1,6 @@
 using System.Data;
 using TUGraz.VectoCore.Models.Simulation.Data;
+using TUGraz.VectoCore.Utils;
 
 namespace TUGraz.VectoCore.Tests.Utils
 {
@@ -33,5 +34,11 @@ namespace TUGraz.VectoCore.Tests.Utils
             get { return CurrentRow[key.GetName()]; }
             set { CurrentRow[key.GetName()] = value; }
         }
+
+	    public double GetDouble(ModalResultField key)
+	    {
+		    return CurrentRow.Field<double>(key.GetName());
+	    }
+
     }
 }
diff --git a/VectoCoreTest/VectoCoreTest.csproj b/VectoCoreTest/VectoCoreTest.csproj
index 222889f5ad..5b3b7709b8 100644
--- a/VectoCoreTest/VectoCoreTest.csproj
+++ b/VectoCoreTest/VectoCoreTest.csproj
@@ -51,6 +51,7 @@
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
+    <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Design" />
     <Reference Include="System.Xml" />
   </ItemGroup>
-- 
GitLab