Esempio n. 1
0
 public MatchResult(long teamNumber, string eventCode, long matchNumber, long rp, long tbp, long score, bool dqOrNoShow, TMatchOutcome outcome)
 {
     TeamNumber        = teamNumber;
     EventCode         = eventCode;
     MatchNumber       = matchNumber;
     RankingPoints     = rp;
     TieBreakingPoints = tbp;
     Score             = score;
     DQorNoShow        = dqOrNoShow;
     Outcome           = outcome;
 }
        public void AddMatch(int rankingPoints, int total, int TBP, bool DQorNoShow, TMatchOutcome outcome)
        {
            RankingPoints += rankingPoints;
            ++MatchesPlayed;
            if (DQorNoShow)
            {
                ++NumDQedOrNoShow;
                if (rankingPoints > 0 || TBP > 0)
                {
                    throw new InternalErrorException($"WARNING: IMPROPER DQ/NO SHOW PROCESSED. RP:{rankingPoints} TBP:{TBP}");
                }
            }
            else
            {
                HighestTBP.Add(TBP);
                HighestTBP.Sort((m1, m2) => m2 - m1); // decreasing order
            }

            TBPMatchesPlayed = GetTBPMatchesPlayed(RankingType, MatchesPlayed, NumDQedOrNoShow);
            HighestMatches.Add(total);
            HighestMatches.Sort((m1, m2) => m2 - m1);

            TieBreakingPoints = HighestTBP.Take(Math.Max(TBPMatchesPlayed - NumDQedOrNoShow, 0)).Sum();
            switch (outcome)
            {
            case TMatchOutcome.WIN:
                ++Wins;
                break;

            case TMatchOutcome.LOSS:
                ++Losses;
                break;

            case TMatchOutcome.TIE:
                ++Ties;
                break;

            case TMatchOutcome.UNKNOWN:
                break;
            }
        }