Exemplo n.º 1
0
        // заполняет таблицу времени доступа элементов к коллекциям
        public double[,] SearchTime()
        {
            Worker[] team = getNodes();
            double[,] timeTable = new double[4, 4]; // строки - это элементы, столбцы - это коллекции
            DateTime now;

            for (int i = 0; i < 4; i++)
            {
                Worker worker = team[i];
                Person basis  = worker.Base;
                string name   = worker.ToString();

                for (int j = 0; j < 4; j++)
                {
                    now = DateTime.Now;

                    switch (j)
                    {
                    case 0: People.Contains(basis); break;

                    case 1: Names.Contains(name); break;

                    case 2: Couples.ContainsValue(worker); break;

                    case 3: Book.ContainsKey(name); break;
                    }

                    timeTable[i, j] = (DateTime.Now - now).TotalMilliseconds;
                }
            }

            return(timeTable);
        }
Exemplo n.º 2
0
        public void Remove(Person person)
        {
            string key = person.ToString();

            People.Remove(person);
            Names.Remove(key);
            Couples.Remove(person);
            Book.Remove(key);
        }
Exemplo n.º 3
0
        public void LoadParticipants(string file)
        {
            System.IO.StreamReader sr = null;

            try
            {
                sr = new System.IO.StreamReader(file, System.Text.Encoding.UTF8);
            }
            catch (Exception)
            {
                return;
            }
            while (!sr.EndOfStream)
            {
                var line = sr.ReadLine();
                try
                {
                    var data = line.Split(';');
                    if (data.Length < 12)
                    {
                        data = line.Split(','); // Try to split comma
                    }
                    // Do we have this couple?
                    var c = Couples.FirstOrDefault(co => co.Man.FirstName == data[4] &&
                                                   co.Man.LastName == data[5] &&
                                                   co.Woman.FirstName == data[6] &&
                                                   co.Woman.LastName == data[7]
                                                   );
                    if (c == null)
                    {
                        c     = new Couple();
                        c.Man = new Person()
                        {
                            FirstName = data[4], LastName = data[5], Country = data[8]
                        };
                        c.Woman = new Person()
                        {
                            FirstName = data[6], LastName = data[7], Country = data[8]
                        };
                        Couples.Add(c);
                    }
                    // Add the competition to your competition list
                    c.AddParticipation(data[0], data[11]);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("mal-formed participant file in line " + line);
                }
            }

            sr.Close();
        }
Exemplo n.º 4
0
        void Init(int players, int wins)
        {
            _TeamLength = players;
            _WinLength  = wins;

            _Couples = new List <ICouple>();

            for (int i = 0; i < _TeamLength; i++)
            {
                ICouple couple = new Couple(Team1.Players[i], Team2.Players[i]);
                StartGameHandler += couple.StartEvent;
                Couples.Add(couple);
            }

            TaskPool          = new List <Task>();
            CancelTokenSource = new CancellationTokenSource();
            Token             = CancelTokenSource.Token;
        }
Exemplo n.º 5
0
 public IEnumerable <TimeFloat> GetContrastAdd()
 {
     return(GetTimeFloats(Couples.GetElement(19 + 64)));
 }
Exemplo n.º 6
0
 public IEnumerable <TimeFloat> GetBrightnessAdd()
 {
     return(GetTimeFloats(Couples.GetElement(18 + 64)));
 }
Exemplo n.º 7
0
 public IEnumerable <TimeFloat> GetSaturationAdd()
 {
     return(GetTimeFloats(Couples.GetElement(17 + 64)));
 }
Exemplo n.º 8
0
 public IEnumerable <TimeFloat> GetTargetLumMaxAdd()
 {
     return(GetTimeFloats(Couples.GetElement(5 + 64)));
 }
Exemplo n.º 9
0
 public IEnumerable <TimeFloat> GetTargetLumMinMult()
 {
     return(GetTimeFloats(Couples.GetElement(4)));
 }
Exemplo n.º 10
0
 public IEnumerable <TimeFloat> GetBloomScaleAdd()
 {
     return(GetTimeFloats(Couples.GetElement(3 + 64)));
 }
Exemplo n.º 11
0
 public IEnumerable <TimeFloat> GetBloomTresholdAdd()
 {
     return(GetTimeFloats(Couples.GetElement(2 + 64)));
 }
Exemplo n.º 12
0
 public IEnumerable <TimeFloat> GetBloomBlurRadiusAdd()
 {
     return(GetTimeFloats(Couples.GetElement(1 + 64)));
 }
Exemplo n.º 13
0
 public IEnumerable <TimeFloat> GetEyeAdaptAdd()
 {
     return(GetTimeFloats(Couples.GetElement(0 + 64)));
 }
Exemplo n.º 14
0
            public override bool Equals(Object o)
            {
                Couples c = (Couples)o;

                return(a == c.a || a == c.b || b == c.a || b == c.b);
            }