private DisplayItemWithLap <int> GetMaxGainPerLap(RaceLap lap) { DisplayItemWithLap <int>?ret = null; int nextPos = lap.CurrentPosition; lap = lap.PreviousLap as RaceLap; while (lap != null) { int diff = lap.CurrentPosition - nextPos; if (ret == null || ret.Value.Item <= diff) { ret = new DisplayItemWithLap <int>(diff, lap.LapNumber); } nextPos = lap.CurrentPosition; lap = lap.PreviousLap as RaceLap; } if (ret == null) { return(new DisplayItemWithLap <int>()); } else { return(ret.Value); } }
private DisplayItemWithLap <Time> GetBestTime(RaceLap lap) { var retLap = lap.GetThrough(i => i.BetterLap); DisplayItemWithLap <Time> ret = new DisplayItemWithLap <Time>(retLap.Time, retLap.LapNumber); return(ret); }