Example #1
0
 public MultiUnitGroup(MultiList multiList, int startSibIndex, bool isAddFromEnd = true)
 {
     this.multiList     = multiList;
     this.startSibIndex = startSibIndex;
     //groupIdCur++;
     //groupid = groupIdCur;
 }
Example #2
0
        public void MargeList()
        {
            List <int> a = new List <int>()
            {
                5, 7, 8
            };
            List <int> c = new List <int>()
            {
                15, 47, 3, 121
            };
            List <int> d = new List <int>()
            {
                7, 5
            };
            //MultiList<List<int>, int> marge =
            List <int> excepted = new List <int>();

            excepted.AddRange(a);
            excepted.AddRange(c);
            excepted.AddRange(d);
            MultiList <List <int>, int> date = new MultiList <List <int>, int>((X) => X, a, c, d);

            for (int i = 0; i < excepted.Count; i++)
            {
                Assert.IsTrue(excepted[i] == date[i]);
            }
        }
Example #3
0
        public void MargeList_Set()
        {
            List <int> a = new List <int>()
            {
                5, 7, 8
            };
            List <int> c = new List <int>()
            {
                15, 47, 3, 121
            };
            List <int> d = new List <int>()
            {
                7, 5
            };
            //MultiList<List<int>, int> marge =
            List <int> excepted = new List <int>();

            excepted.AddRange(a);
            excepted.AddRange(c);
            excepted.AddRange(d);
            MultiList <List <int>, int> date = new MultiList <List <int>, int>((X) => X, a, c, d);

            date[2] = 133;
            Assert.AreEqual(a[2], 133);
        }
Example #4
0
        private void SelectGame(params DataGame[] game)
        {
            listBoxTgdbIds.BeginUpdate();
            listBoxTgdbIds.DataSource = null;
            listBoxTgdbIds.Items.Clear();

            if (game.Length == 1)
            {
                listBoxTgdbIds.DataSource = game[0].TgdbId;
            }
            else if (game.Length > 1)
            {
                var lists        = game.Select(l => l.TgdbId);
                var intersection = lists
                                   .Skip(1)
                                   .Aggregate(
                    new HashSet <int>(lists.First()),
                    (h, e) => { h.IntersectWith(e); return(h); }
                    );
                var list = new MultiList <int, DataGame>();
                list.InnerData.AddRange(game);
                list.AddRange(intersection.ToList());
                listBoxTgdbIds.DataSource = list;
            }

            listBoxTgdbIds.EndUpdate();
            listBoxTgdbIds.EndUpdate();
        }