Exemplo n.º 1
0
        public bool ReplaceInAllArrays(RoundDebater old, RoundDebater rd)
        {
            // don't rely on the role of old, might have changed.

            // search in AllTeams
            foreach (TeamData team in allTeams)
            {
                for (int i = 0; i < team.Count; i++)
                {
                    if (old.Equals(team[i]))
                    {
                        team[i] = rd;
                        return(true);
                    }
                }
            }
            // search in AllJudges
            for (int i = 0; i < allJudges.Count; i++)
            {
                if (old.Equals(allJudges[i]))
                {
                    allJudges[i] = rd;
                    return(true);
                }
            }
            // none found
            return(false);
        }
Exemplo n.º 2
0
        public bool ReplaceRoomMember(RoundDebater old, RoundDebater rd)
        {
            // don't rely on the role of old, might have changed.
            // search gov/opp

            for (int i = 0; i < 3; i++)
            {
                if (old.Equals(gov[i]))
                {
                    Console.WriteLine("Gov: " + old + " -> " + rd);
                    gov[i] = rd;
                    return(true);
                }
                if (old.Equals(opp[i]))
                {
                    Console.WriteLine("Opp: " + old + " -> " + rd);
                    opp[i] = rd;
                    return(true);
                }
            }
            // search free
            for (int i = 0; i < freeSpeakers.Count; i++)
            {
                if (old.Equals(freeSpeakers[i]))
                {
                    Console.WriteLine("Free: " + old + " -> " + rd);
                    freeSpeakers[i] = rd;
                    return(true);
                }
            }
            // search chair and judges
            if (old.Equals(chair))
            {
                Console.WriteLine("Chair: " + old + " -> " + rd);
                chair = rd;
            }
            for (int i = 0; i < judges.Count; i++)
            {
                if (old.Equals(judges[i]))
                {
                    Console.WriteLine("Judge: " + old + " -> " + rd);
                    judges[i] = rd;
                    return(true);
                }
            }
            return(false);
        }