Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 21aed7e2 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

Renamed GetValueOrDefault --> GetVECTOValueOrDefault due to nameclash with DataExtensions Library

parent f4a5b0f7
No related branches found
No related tags found
No related merge requests found
......@@ -240,7 +240,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
}
}
return mission.BusParameter.ElectricalConsumers.GetValueOrDefault(consumer.ConsumerName, 0);
return mission.BusParameter.ElectricalConsumers.GetVECTOValueOrDefault(consumer.ConsumerName, 0);
}
protected virtual Dictionary<string, ElectricConsumerEntry> GetElectricAuxConsumers(Mission mission, IVehicleDeclarationInputData vehicleData, VehicleClass vehicleClass, IBusAuxiliariesDeclarationData busAux)
......
......@@ -135,7 +135,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric
public Ampere NominalCurrent(MissionType mission)
{
return _missions.GetValueOrDefault(mission, 0.SI<Ampere>());
return _missions.GetVECTOValueOrDefault(mission, 0.SI<Ampere>());
}
public Ampere this[MissionType mission]
......
......@@ -109,7 +109,7 @@ namespace TUGraz.VectoCore.Models.Declaration
public override AuxDemandEntry Lookup(MissionType mission, string technology, bool electrical)
{
var lookup = Tuple.Create(mission, technology, electrical);
return Data.GetValueOrDefault(lookup, new AuxDemandEntry { PowerDemand = 0.SI<Watt>() });
return Data.GetVECTOValueOrDefault(lookup, new AuxDemandEntry { PowerDemand = 0.SI<Watt>() });
}
public string[] FullyElectricTechnologies() => Data.Keys.Where(x => x.Item3).Select(x => x.Item2).Distinct().ToArray();
......
......@@ -89,7 +89,7 @@ namespace TUGraz.IVT.VectoXML.Writer
table.Columns.Cast<DataColumn>()
.Where(c => mapping.ContainsKey(c.ColumnName))
.Select(c => new XAttribute(mapping[c.ColumnName],
row.Field<string>(c).ToDouble().ToXMLFormat(precision?.GetValueOrDefault(c.ColumnName, 2u) ?? 2u)))))
row.Field<string>(c).ToDouble().ToXMLFormat(precision?.GetVECTOValueOrDefault(c.ColumnName, 2u) ?? 2u)))))
.Cast<object>().ToArray();
}
}
......
......@@ -90,7 +90,7 @@ namespace TUGraz.VectoCore.OutputData.XML.Engineering.Writer
table.Columns.Cast<DataColumn>()
.Where(c => mapping.ContainsKey(c.ColumnName))
.Select(c => new XAttribute(mapping[c.ColumnName],
row.Field<string>(c).ToDouble().ToXMLFormat(precision?.GetValueOrDefault(c.ColumnName, 2u) ?? 2u)))))
row.Field<string>(c).ToDouble().ToXMLFormat(precision?.GetVECTOValueOrDefault(c.ColumnName, 2u) ?? 2u)))))
.Cast<object>().ToArray();
}
......
......@@ -64,7 +64,8 @@ namespace TUGraz.VectoCore.Utils
public static TValue GetVECTOValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey key) =>
self.TryGetValue(key, out var value) ? value : default;
public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey key, TValue defaultValue) =>
public static TValue GetVECTOValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> self, TKey key, TValue defaultValue) =>
self.TryGetValue(key, out var value) ? value : defaultValue;
}
}
\ No newline at end of file
......@@ -66,7 +66,7 @@ namespace TUGraz.VectoCore.Utils
{
var t = typeof(T).Name;
var c = Current.GetOrAdd(t, _ => new Dictionary<string, double>());
c[key] = c.GetValueOrDefault(key, 0) + value ?? 1;
c[key] = c.GetVECTOValueOrDefault(key, 0) + value ?? 1;
}
[Conditional("TRACE")]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment