Beispiel #1
0
        public void RemoveAll()
        {
            var list2 = new HashBag <int>();

            hashbag.Add(4);
            hashbag.Add(5);
            hashbag.Add(6);
            hashbag.Add(4);
            hashbag.Add(5);
            list2.Add(5);
            list2.Add(4);
            list2.Add(7);
            list2.Add(4);
            hashbag.RemoveAll(list2);
            Assert.IsTrue(IC.seteq(hashbag, 5, 6));
            hashbag.Add(5);
            hashbag.Add(4);
            list2.Clear();
            list2.Add(6);
            list2.Add(5);
            hashbag.RemoveAll(list2);
            Assert.IsTrue(IC.seteq(hashbag, 4, 5));
            list2.Clear();
            list2.Add(7);
            list2.Add(8);
            list2.Add(9);
            hashbag.RemoveAll(list2);
            Assert.IsTrue(IC.seteq(hashbag, 4, 5));
        }
Beispiel #2
0
        public void RemoveAllTest1()
        {
            var bag = new HashBag <int> {
                3, 5, 1, 1, 4, 6, 2, 2, 2
            };

            Assert.Equal(9, bag.Count);

            Assert.Equal(2, bag.RemoveAll(1));
            Assert.Equal(7, bag.Count);

            Assert.Equal(0, bag.RemoveAll(10));
            Assert.Equal(7, bag.Count);

            Assert.Equal(3, bag.RemoveAll(2));
            Assert.Equal(4, bag.Count);

            Assert.Equal(1, bag.RemoveAll(5));
            Assert.Equal(3, bag.Count);
        }
        internal void RemoveFunction(SdfInfo info)
        {
            inputCellBag.RemoveAll(info.inputCells);
            outputCellBag.Remove(info.outputCell);
            List <FullCellAddr> addresses;

            if (!functionToAddressList.TryGetValue(info.name, out addresses))
            {
                return;
            }
            foreach (FullCellAddr addr in addresses)
            {
                addressToFunctionList.Remove(addr);
            }
            functionToAddressList.Remove(info.name);
        }