private void EvaluateMaximumMinimumCountOfDriver(
            out DriverStatRecord <int> minF, out DriverStatRecord <int> maxF,
            out DriverStatRecord <int> minA, out DriverStatRecord <int> maxA)
        {
            minF = new DriverStatRecord <int>(int.MaxValue);
            maxF = new DriverStatRecord <int>(int.MinValue);
            minA = new DriverStatRecord <int>(int.MaxValue);
            maxA = new DriverStatRecord <int>(int.MinValue);
            int val;

            foreach (Standings.RaceStanding item in this.w.Race.Standings)
            {
                val = item.PitInfo.PitCount;
                if (item.Status == Standings.RaceStanding.eStatus.Running)
                {
                    if (minF.CompareTo(val) > 0)
                    {
                        minF = new DriverStatRecord <int>(item.Driver, val);
                    }
                    if (maxF.CompareTo(val) < 0)
                    {
                        maxF = new DriverStatRecord <int>(item.Driver, val);
                    }
                }
                if (minA.CompareTo(val) > 0)
                {
                    minA = new DriverStatRecord <int>(item.Driver, val);
                }
                if (maxA.CompareTo(val) < 0)
                {
                    maxA = new DriverStatRecord <int>(item.Driver, val);
                }
            }
        }
        private DriverStatRecord <double> GetFastestLapDriver()
        {
            DriverStatRecord <double> ret = new DriverStatRecord <double>(null, double.MaxValue);

            foreach (Standings.RaceStanding item in r.Standings)
            {
                if (item.OrderedLaps.Count > 0 && ret.CompareTo(item.OrderedLaps[0].LapTime) > 0)
                {
                    ret = new DriverStatRecord <double>(item.Driver, item.OrderedLaps[0].LapTime);
                }
            }
            return(ret);
        }
        private void CalculateCautions()
        {
            this.Cautions.NumberOfCautions = r.YellowPhases.Length;

            int shortest = int.MaxValue;
            int longest  = int.MinValue;
            int green    = int.MinValue;
            int lastEnd  = 0;
            int diff;

            foreach (var fItem in r.YellowPhases)
            {
                diff     = fItem.Item2 - fItem.Item1;
                shortest = Math.Min(shortest, diff);
                longest  = Math.Max(longest, diff);
                diff     = fItem.Item1 - lastEnd;
                green    = Math.Max(green, diff);
                lastEnd  = fItem.Item2;
            } // foreach (var fItem in r.YellowPhases)

            diff  = r.TotalLapCount - r.YellowPhases[r.YellowPhases.Length - 1].Item2;
            green = Math.Max(green, diff);

            this.Cautions.LongestCautionBlock  = longest;
            this.Cautions.ShortestCautionBlock = shortest;
            this.Cautions.LongestGreenBlock    = green;

            DriverStatRecord <int> maxF = new DriverStatRecord <int>(null, 0);
            DriverStatRecord <int> minF = new DriverStatRecord <int>(null, 0);
            DriverStatRecord <int> maxA = new DriverStatRecord <int>(null, 0);
            DriverStatRecord <int> minA = new DriverStatRecord <int>(null, 0);

            EvaluateMaximumMinimumCountOfDriver(out minF, out maxF, out minA, out maxA);
            this.Cautions.MinimumPitCountOfFinishedDriver = minF;
            this.Cautions.MaximumPitCountOfFinishedDriver = maxF;
            this.Cautions.MinimumPitCountOfAnyDriver      = minA;
            this.Cautions.MaximumPitCountOfAnyDriver      = maxA;
        }
 public int CompareTo(DriverStatRecord <T> other)
 {
     return(this.Value.CompareTo(other.Value));
 }