public static ChampionshipStatistic GetChampionships(Result[,] results, PointScoringSystem pointSystem, bool doublePoints) { ChampionshipStatistic statistic = new ChampionshipStatistic(); statistic.PointSystem = pointSystem; statistic.DoublePoints = doublePoints; statistic.SetResults(results); statistic.CalculateStatistics(); statistic.Sort(OrderType.Descending, SortType.Value); return statistic; }
public ChampionshipData(PointScoringSystem PointSystem, bool DoublePoints, Session session) { this.pointSystem = PointSystem; this.doublePoints = DoublePoints; this.session = session; DriverResultsTableUpdater.DatabaseModified += DriverResultsTableUpdater_DatabaseModified; StatisticManager.ShowComparison += StatisticManager_ResultsUpdated; StatisticManager.ComparisonCleared += StatisticManager_ComparisonCleared; DataLoadedFromDatabase += ChampionshipData_DataLoaded; GetResultsFromData(session); PointSystemChanged += ChampionshipData_PointSystemChanged; DoublePointsChanged += ChampionshipData_DoublePointsChanged; }
public static int GetPoints(this PointScoringSystem pointSystem, int position, bool doublePoints) { int pointsScored = 0; switch (pointSystem) { case PointScoringSystem.Post2009: switch (position) { case 1: pointsScored = 25; break; case 2: pointsScored = 18; break; case 3: pointsScored = 15; break; case 4: pointsScored = 12; break; case 5: pointsScored = 10; break; case 6: pointsScored = 8; break; case 7: pointsScored = 6; break; case 8: pointsScored = 4; break; case 9: pointsScored = 2; break; case 10: pointsScored = 1; break; default: pointsScored = 0; break; } break; case PointScoringSystem.Post2002: switch (position) { case 1: pointsScored = 10; break; case 2: pointsScored = 8; break; case 3: pointsScored = 6; break; case 4: pointsScored = 5; break; case 5: pointsScored = 4; break; case 6: pointsScored = 3; break; case 7: pointsScored = 2; break; case 8: pointsScored = 1; break; default: pointsScored = 0; break; } break; case PointScoringSystem.Post1990: switch (position) { case 1: pointsScored = 10; break; case 2: pointsScored = 6; break; case 3: pointsScored = 4; break; case 4: pointsScored = 3; break; case 5: pointsScored = 2; break; case 6: pointsScored = 1; break; default: pointsScored = 0; break; } break; } if (doublePoints) { pointsScored *= 2; } return(pointsScored); }