Ejemplo n.º 1
0
        public static DebaterPattern Parse(string s)
        {
            if (s == null)
            {
                throw new ArgumentNullException();
            }


            var parts = s.Split(';');
            var ret   = new DebaterPattern();

            foreach (string p in parts)
            {
                var tmp = p.Trim();
                if (tmp.StartsWith("@", StringComparison.Ordinal))
                {
                    Club.Parse(tmp.Substring(1)).Do(
                        club => ret.AddClub(club.Name));
                }
                else if (tmp != "")
                {
                    Name.Parse(tmp).Do(ret.AddDebater);
                }
                // TODO The above swallows errors if Club.Parse() or
                // Name.Parse() fail.
            }

            return(ret);
        }
Ejemplo n.º 2
0
 void InitFields()
 {
     extraInfo    = "";
     roundResults = new List <RoundResultData>();
     statsAvg     = new List <double>();
     visitedRooms = new MyDictionary <string, int>();
     blackList    = new DebaterPattern();
     whiteList    = new DebaterPattern();
 }
Ejemplo n.º 3
0
 public Debater(Debater d) : base(d)
 {
     InitFields();
     // ALWAYS COPY!
     // TODO implement proper copying
     extraInfo    = d.ExtraInfo;
     roundResults = new List <RoundResultData>(d.RoundResults);
     visitedRooms = new MyDictionary <string, int>(d.VisitedRooms);
     blackList    = DebaterPattern.Parse(d.BlackList.ToString());
     whiteList    = DebaterPattern.Parse(d.WhiteList.ToString());
 }