Example #1
0
        /// <summary>
        /// Copies the IsStillInCompetition, Abandoned, Forfait and Excluded values from all fencers in given poule round
        /// to the internal ranking.
        /// </summary>
        /// <param name="pouleRound"></param>
        private void registerEliminationOnRankList(FRCPouleRound pouleRound)
        {
            FRCFencer fencer;

            pouleRound.resetFencerIndex();

            for (int i = 0; i < pouleRound.amountOfFencers(); i++)
            {
                fencer = pouleRound.getNextFencer();
                for (int j = 0; j < rankListAllPouleRounds.Count; j++)
                {
                    if (fencer.ID == rankListAllPouleRounds[j].ID)
                    {
                        if (rankListAllPouleRounds[j].IsStillInTheCompetition)
                        {
                            rankListAllPouleRounds[j].IsStillInTheCompetition = fencer.IsStillInTheCompetition;
                        }

                        //These abandoned, excluded, forfait assignments are probably unnecessary, but they are not wrong and it works.
                        if (!rankListAllPouleRounds[j].Abandoned)
                        {
                            rankListAllPouleRounds[j].Abandoned = fencer.Abandoned;
                        }
                        if (!rankListAllPouleRounds[j].Excluded)
                        {
                            rankListAllPouleRounds[j].Excluded = fencer.Excluded;
                        }
                        if (!rankListAllPouleRounds[j].Forfait)
                        {
                            rankListAllPouleRounds[j].Forfait = fencer.Forfait;
                        }
                        break;
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Checks which format is used for tableau ranking.
        /// </summary>
        /// <param name="lastPouleRound">The last poule round.</param>
        private void checkTableauRankFormat(FRCPouleRound lastPouleRound)
        {
            lastPouleRound.sortFencerPouleRanking();
            interpreter.Tableau.sortFencerInitialRanking();
            sortRankListAllPouleRounds();
            FRCFencer pouleFencer, tableauFencer;

            //Compare ranking from last poule round with initial ranking for the tableau.
            for (int i = 0; i < lastPouleRound.amountOfFencers(); i++)
            {
                pouleFencer = lastPouleRound.getNextFencer();
                //Skips all eliminated, excluded, abandoned and scratched fencers.
                if (!pouleFencer.IsStillInTheCompetition)
                {
                    continue;
                }

                tableauFencer = interpreter.Tableau.getNextFencer();
                if (tableauFencer.ID != pouleFencer.ID)
                {
                    lastPouleRound.resetFencerIndex();
                    interpreter.Tableau.resetFencerIndex();
                    qualifyLastRankAll = true;
                    return;
                }
            }

            int  lastPhaseFinalRanking = -1;
            bool different             = false;

            //Compare ranking from last poule round with internal summing ranking of all poule rounds.
            for (int i = 0; i < rankListAllPouleRounds.Count; i++)
            {
                pouleFencer = lastPouleRound.getNextFencer();

                if (different)
                {
                    if (pouleFencer.PhaseFinalRanking == lastPhaseFinalRanking)
                    {
                        different = false;
                        continue;
                    }
                    lastPouleRound.resetFencerIndex();
                    qualifyLastRankLast = true;
                    return;
                }

                //Skips all eliminated, excluded, abandoned and scratched fencers.
                if (pouleFencer.IsStillInTheCompetition && rankListAllPouleRounds[i].IsStillInTheCompetition)
                {
                    if (rankListAllPouleRounds[i].ID != pouleFencer.ID)
                    {
                        different = true;
                    }
                }
                lastPhaseFinalRanking = pouleFencer.PhaseFinalRanking;
            }

            //If the last fencer is different.
            if (different)
            {
                qualifyLastRankLast = true;
                return;
            }

            lastPouleRound.resetFencerIndex();
            qualifyAllRankAll = true;
        }