Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 5b706429 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Pull request #71: Avoid reading Gears-Data everytime on property usage.

Merge in VECTO/vecto-dev from VECTO/mk_vecto-dev:develop to develop

* commit '61cc9800':
  cached Gears data to avoid reading it multiple times.
parents 42e473d7 61cc9800
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,8 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
{
public class JSONGearboxDataV6 : JSONGearboxDataV5
{
private IList<ITransmissionInputData> resultGears;
public JSONGearboxDataV6(JObject data, string filename, bool tolerateMissing = false)
: base(data, filename, tolerateMissing) {}
......@@ -54,12 +56,14 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
public override IList<ITransmissionInputData> Gears
{
get {
var resultGears = new List<ITransmissionInputData>();
var gears = Body.GetEx(JsonKeys.Gearbox_Gears);
for (var i = 1; i < gears.Count(); i++) {
var gear = gears[i];
if (resultGears == null) {
resultGears = new List<ITransmissionInputData>();
var gears = Body.GetEx(JsonKeys.Gearbox_Gears);
for (var i = 1; i < gears.Count(); i++) {
var gear = gears[i];
resultGears.Add(CreateGear(i, gear));
resultGears.Add(CreateGear(i, gear));
}
}
return resultGears;
}
......
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