Exemple #1
0
        /// <summary>
        /// Returns a clone of this team.
        /// </summary>
        /// <returns></returns>
        public Object Clone()
        {
            FRCTeam cTeam = new FRCTeam();

            cTeam.Abandoned                = this.Abandoned;
            cTeam.Club                     = this.Club;
            cTeam.Excluded                 = this.Excluded;
            cTeam.ID                       = this.ID;
            cTeam.FencerNumberInPoule      = this.FencerNumberInPoule;
            cTeam.FinalRanking             = this.FinalRanking;
            cTeam.Name                     = this.Name;
            cTeam.Forfait                  = this.Forfait;
            cTeam.HitsGivenInPoule         = this.HitsGivenInPoule;
            cTeam.HitsTakenInPoule         = this.HitsTakenInPoule;
            cTeam.InitialRanking           = this.InitialRanking;
            cTeam.IsStillInTheCompetition  = this.IsStillInTheCompetition;
            cTeam.Nationality              = this.Nationality;
            cTeam.NumberOfMatchesInPoule   = this.NumberOfMatchesInPoule;
            cTeam.NumberOfVictoriesInPoule = this.NumberOfVictoriesInPoule;
            cTeam.PhaseFinalRanking        = this.PhaseFinalRanking;
            cTeam.PhaseInitialRanking      = this.PhaseInitialRanking;
            cTeam.PouleRanking             = this.PouleRanking;
            cTeam.VM_String                = this.VM_String;

            return(cTeam);
        }
Exemple #2
0
 /// <summary>
 /// Sorts all teams in this tableau after their initial rankings. Lowest number first.
 /// </summary>
 public void sortTeamInitialRanking()
 {
     for (int i = 0; i < team.Count - 1; i++)
     {
         for (int j = i + 1; j < team.Count; j++)
         {
             if (team[i].PhaseInitialRanking > team[j].PhaseInitialRanking)
             {
                 FRCTeam tempTeam = team[j];
                 team[j] = team[i];
                 team[i] = tempTeam;
             }
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Sorts team after their fencer number in this poule.
 /// </summary>
 public void sortTeamsFencerNumberInPoule()
 {
     for (int i = 0; i < team.Count - 1; i++)
     {
         for (int j = i + 1; j < team.Count; j++)
         {
             if (team[i].FencerNumberInPoule > team[j].FencerNumberInPoule)
             {
                 FRCTeam tempTeam = team[j];
                 team[j] = team[i];
                 team[i] = tempTeam;
             }
         }
     }
 }
Exemple #4
0
 /// <summary>
 /// Add a team to the poule round.
 /// </summary>
 /// <param name="team"></param>
 public void addTeam(FRCTeam team)
 {
     this.team.Add(team);
 }
Exemple #5
0
        /// <summary>
        /// Intreprets the information of the poule round from the xml file.
        /// </summary>
        private void interpretPouleRound()
        {
            if (reader.Name == TOUR_DE_POULES)
            {
                pouleRoundIntro = true;
                poulePhase      = true;
                FRCPouleRound pr = new FRCPouleRound();
                while (reader.MoveToNextAttribute())
                {
                    if (reader.Name == ID)
                    {
                        pr.RoundNumber = int.Parse(reader.Value);
                    }
                    else if (reader.Name == NB_DE_POULES)
                    {
                        pr.NumOfPoules = int.Parse(reader.Value);
                    }
                    else if (reader.Name == NB_QUALIFIES_PAR_INDICE)
                    {
                        pr.NumOfQualifiers = int.Parse(reader.Value);
                    }

                    //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                }

                pouleRound.Add(pr);
            } //Checks that TIREUR or EQUIPE appears during the intro of the poule round.
            else if ((reader.Name == TIREUR || reader.Name == EQUIPE) && (pouleRoundIntro))
            {
                FRCCompetitor athlete;
                if (isIndividualCompetition)
                {
                    athlete = new FRCFencer();
                }
                else
                {
                    athlete = new FRCTeam();
                }

                int i = -1;

                while (reader.MoveToNextAttribute())
                {
                    if (reader.Name == REF)
                    {
                        athlete.ID = int.Parse(reader.Value);
                        if (isIndividualCompetition) //Copying info from this.fencer if individual competition
                        {
                            for (i = 0; i < this.fencer.Count; i++)
                            {
                                if (athlete.ID == this.fencer[i].ID)
                                {
                                    athlete = (FRCFencer)this.fencer[i].Clone();
                                    break;
                                }
                            }
                        }
                        else //Copying info from this.team if team competition
                        {
                            for (i = 0; i < this.team.Count; i++)
                            {
                                if (athlete.ID == this.team[i].ID)
                                {
                                    athlete = (FRCTeam)this.team[i].Clone();
                                    break;
                                }
                            }
                        }
                    }
                    else if (reader.Name == RANG_INITIAL)
                    {
                        athlete.PhaseInitialRanking = int.Parse(reader.Value);
                        //Sets initial ranking of the competitor.
                        if (isIndividualCompetition)
                        {
                            if (fencer[i].InitialRanking == -1)
                            {
                                fencer[i].InitialRanking = int.Parse(reader.Value);
                            }
                        }
                        else
                        {
                            if (team[i].InitialRanking == -1)
                            {
                                team[i].InitialRanking = int.Parse(reader.Value);
                            }
                        }
                    }
                    else if (reader.Name == RANG_FINAL)
                    {
                        athlete.PhaseFinalRanking = int.Parse(reader.Value);
                    }
                    else if (reader.Name == STATUT)
                    {
                        athlete.NoStatusException = false;
                        if (reader.Value == "Q")
                        {
                            athlete.IsStillInTheCompetition = true;
                        }
                        else if (reader.Value == "N")
                        {
                            athlete.IsStillInTheCompetition = false;
                        }
                        else if (reader.Value == "A")
                        {
                            athlete.IsStillInTheCompetition = false;
                            athlete.Abandoned = true;
                            if (isIndividualCompetition)
                            {
                                fencer[i].Abandoned = true;
                            }
                            else
                            {
                                team[i].Abandoned = true;
                            }
                        }
                        else if (reader.Value == "F")
                        {
                            athlete.IsStillInTheCompetition = false;
                            athlete.Forfait = true;
                            if (isIndividualCompetition)
                            {
                                fencer[i].Forfait = true;
                            }
                            else
                            {
                                team[i].Forfait = true;
                            }
                        }
                        else if (reader.Value == "E")
                        {
                            athlete.IsStillInTheCompetition = false;
                            athlete.Excluded = true;
                            if (isIndividualCompetition)
                            {
                                fencer[i].Excluded = true;
                            }
                            else
                            {
                                team[i].Excluded = true;
                            }
                        }
                    }
                    //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                }
                if (isIndividualCompetition)
                {
                    pouleRound[pouleRound.Count - 1].addFencer((FRCFencer)athlete);
                }
                else
                {
                    pouleRound[pouleRound.Count - 1].addTeam((FRCTeam)athlete);
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// A method to be called from interpretPoule().
        /// </summary>
        private void interpretTireurOrEquipeInPoule()
        {
            FRCCompetitor athlete;

            if (isIndividualCompetition)
            {
                athlete = new FRCFencer();
            }
            else
            {
                athlete = new FRCTeam();
            }

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == REF)
                {
                    athlete.ID = int.Parse(reader.Value);

                    if (isIndividualCompetition) //Copying info from this.fencer if individual competition
                    {
                        for (int i = 0; i < this.fencer.Count; i++)
                        {
                            if (athlete.ID == this.fencer[i].ID)
                            {
                                athlete = (FRCFencer)fencer[i].Clone();
                                break;
                            }
                        }
                    }
                    else //Copying info from this.team if team competition
                    {
                        for (int i = 0; i < this.team.Count; i++)
                        {
                            if (athlete.ID == this.team[i].ID)
                            {
                                athlete = (FRCTeam)team[i].Clone();
                                break;
                            }
                        }
                    }
                }
                else if (reader.Name == NO_DANS_LA_POULE)
                {
                    athlete.FencerNumberInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == NB_VICTOIRES)
                {
                    athlete.NumberOfVictoriesInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == NB_MATCHES)
                {
                    athlete.NumberOfMatchesInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == TD)
                {
                    athlete.HitsGivenInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == TR)
                {
                    athlete.HitsTakenInPoule = int.Parse(reader.Value);
                }
                else if (reader.Name == RANG_POULE)
                {
                    try
                    {
                        athlete.PouleRanking = int.Parse(reader.Value);
                    }
                    catch (Exception)
                    {
                        athlete.PouleRanking = 0;
                    }
                }


                //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
            }
            athlete.VM    = (double)athlete.NumberOfVictoriesInPoule / (double)athlete.NumberOfMatchesInPoule;
            athlete.Index = athlete.HitsGivenInPoule - athlete.HitsTakenInPoule;

            if (isIndividualCompetition)
            {
                pouleRound[pouleRound.Count - 1].getCurrentPoule().addFencer((FRCFencer)athlete);
            }
            else
            {
                pouleRound[pouleRound.Count - 1].getCurrentPoule().addTeam((FRCTeam)athlete);
            }
        }
Exemple #7
0
        /// <summary>
        /// A method to be called from interpretTableau().
        /// </summary>
        private void interpretTireurOrEquipeInTableau()
        {
            FRCCompetitor athlete;

            if (isIndividualCompetition)
            {
                athlete = new FRCFencer();
            }
            else
            {
                athlete = new FRCTeam();
            }

            int i = 0;

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == REF)
                {
                    athlete.ID = int.Parse(reader.Value);
                    if (isIndividualCompetition) //Copying info from this.fencer if individual competition.
                    {
                        for (i = 0; i < this.fencer.Count; i++)
                        {
                            if (athlete.ID == this.fencer[i].ID)
                            {
                                athlete = (FRCFencer)this.fencer[i].Clone();
                                break;
                            }
                        }
                    }
                    else
                    {
                        for (i = 0; i < this.team.Count; i++)
                        {
                            if (athlete.ID == this.team[i].ID)
                            {
                                athlete = (FRCTeam)this.team[i].Clone();
                                break;
                            }
                        }
                    }
                }
                else if (reader.Name == RANG_INITIAL)
                {
                    athlete.PhaseInitialRanking = int.Parse(reader.Value);
                }
                else if (reader.Name == RANG_FINAL)
                {
                    athlete.PhaseFinalRanking = int.Parse(reader.Value);
                }
                else if (reader.Name == STATUT)
                {
                    if (reader.Value == "A")
                    {
                        athlete.IsStillInTheCompetition = false;
                        athlete.Abandoned = true;
                        if (isIndividualCompetition)
                        {
                            fencer[i].Abandoned = true;
                        }
                        else
                        {
                            team[i].Abandoned = true;
                        }
                    }
                    else if (reader.Value == "F")
                    {
                        athlete.IsStillInTheCompetition = false;
                        athlete.Forfait = true;
                        if (isIndividualCompetition)
                        {
                            fencer[i].Forfait = true;
                        }
                        else
                        {
                            team[i].Forfait = true;
                        }
                    }
                    else if (reader.Value == "E")
                    {
                        athlete.IsStillInTheCompetition = false;
                        athlete.Excluded = true;
                        if (isIndividualCompetition)
                        {
                            fencer[i].Excluded = true;
                        }
                        else
                        {
                            team[i].Excluded = true;
                        }
                    }
                }

                //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
            }
            if (isIndividualCompetition)
            {
                tableau[tableau.Count - 1].addFencer((FRCFencer)athlete);
            }
            else
            {
                tableau[tableau.Count - 1].addTeam((FRCTeam)athlete);
            }
        }
Exemple #8
0
        /// <summary>
        /// Interprets info of all teams.
        /// </summary>
        private void interpretEquipe()
        {
            if (!endOfEquipes)
            {
                if (reader.Name == EQUIPE)
                {
                    FRCTeam tempTeam = new FRCTeam();
                    while (reader.MoveToNextAttribute())
                    {
                        if (reader.Name == ID)
                        {
                            tempTeam.ID = int.Parse(reader.Value);
                        }
                        else if (reader.Name == NOM)
                        {
                            tempTeam.Name = reader.Value;
                        }
                        else if (reader.Name == NATION)
                        {
                            tempTeam.Nationality = reader.Value;
                        }
                        else if (reader.Name == CLUB)
                        {
                            tempTeam.Club = reader.Value;
                        }
                        else if (reader.Name == CLASSEMENT)
                        {
                            tempTeam.FinalRanking = int.Parse(reader.Value);
                        }
                    }

                    team.Add(tempTeam);
                }
                else if (reader.Name == TIREUR)
                {
                    FRCFencer tempFencer = new FRCFencer();
                    while (reader.MoveToNextAttribute())
                    {
                        if (reader.Name == ID)
                        {
                            tempFencer.ID = int.Parse(reader.Value);
                        }
                        else if (reader.Name == NOM)
                        {
                            tempFencer.LastName = reader.Value;
                        }
                        else if (reader.Name == PRENOM)
                        {
                            tempFencer.FirstName = reader.Value;
                        }
                        else if (reader.Name == NATION)
                        {
                            tempFencer.Nationality = reader.Value;
                        }
                        else if (reader.Name == CLUB)
                        {
                            tempFencer.Club = reader.Value;
                        }
                    }

                    team[team.Count - 1].addFencer(tempFencer);
                }
            }
        }