Пример #1
0
        void CheckRange(List <RoundDebater> rd, List <Debater> d, int oStart, int oStop, params int[] innerParts)
        {
            // innerParts should have even length
            for (int part = 0; part < innerParts.Length / 2; part++)
            {
                int iStart = innerParts[2 * part];
                int iStop  = innerParts[2 * part + 1];
                // outer loop
                for (int o = oStart; o <= oStop; o++)
                {
                    // inner loop
                    for (int i = iStart; i <= iStop; i++)
                    {
                        if (i == o || rd[i] == null || d[i] == null)
                        {
                            goto inner;
                        }
                        if (rd[o] == null || d[o] == null)
                        {
                            goto outer;
                        }
                        if (d[o].ConflictsWith(d[i]))
                        {
                            RoomConflict.Type t = o < i?GetConflictType(o, i) : GetConflictType(i, o);

                            RoomConflict rc = rd[o].GetConflict();
                            rc.Partners1[t].Add(rd[i]);
                        }

                        inner :;
                    }
                    outer :;
                }
            }
        }
Пример #2
0
        // a sloppy & expensive method for the Team Widget displaying all TeamMembers conflicts...
        public void Merge(RoomConflict rc)
        {
            if (rc == null || rc.IsEmpty)
            {
                return;
            }
            foreach (Type t in Enum.GetValues(typeof(Type)))
            {
                Partners1[t] = new List <RoundDebater>
                                   (Partners1[t].Union(rc.Partners1[t]));
            }

            // Partners2 is a bit more difficult
            // we can't rely on nothing yo man!
            foreach (string key in rc.Partners2.Keys)
            {
                if (!Partners2.ContainsKey(key))
                {
                    // we don't have it...
                    // just add it to ours...
                    Partners2[key] = rc.Partners2[key];
                }
                else if (rc.Partners2.ContainsKey(key))
                {
                    // we have it and they have it, so
                    // union the Complex
                    Partners2[key].Merge(rc.Partners2[key]);
                }
            }
        }
Пример #3
0
 public void SetConflict(RoomConflict rc)
 {
     conflict = rc;
 }