亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bag.cs

?? C#寫的類似于STL的集合類,首先是C#編寫,可以用于.net變程.
?? CS
?? 第 1 頁 / 共 4 頁
字號:
        public sealed override void Clear()
        {
            hash.StopEnumerations();  // Invalidate any enumerations.

            // The simplest and fastest way is simply to throw away the old hash and create a new one.
            hash = new Hash<KeyValuePair<T, int>>(equalityComparer);
            count = 0;
        }

        #endregion Removing elements

        #region Set operations

        /// <summary>
        /// Check that this bag and another bag were created with the same comparison
        /// mechanism. Throws exception if not compatible.
        /// </summary>
        /// <param name="otherBag">Other bag to check comparision mechanism.</param>
        /// <exception cref="InvalidOperationException">If otherBag and this bag don't use the same method for comparing items.</exception>
        private void CheckConsistentComparison(Bag<T> otherBag)
        {
            if (otherBag == null)
                throw new ArgumentNullException("otherBag");

            if (!object.Equals(equalityComparer, otherBag.equalityComparer))
                throw new InvalidOperationException(Strings.InconsistentComparisons);
        }

        /// <summary>
        /// Determines if this bag is equal to another bag. This bag is equal to
        /// <paramref name="otherBag"/> if they contain the same number of 
        /// of copies of equal elements.
        /// </summary>
        /// <remarks>IsSupersetOf is computed in time O(N), where N is the number of unique items in 
        /// this bag.</remarks>
        /// <param name="otherBag">Bag to compare to</param>
        /// <returns>True if this bag is equal to <paramref name="otherBag"/>, false otherwise.</returns>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public bool IsEqualTo(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

            // Must be the same size.
            if (otherBag.Count != this.Count)
                return false;

            // Check each item to make sure it is in this set the same number of times.
            foreach (T item in otherBag.DistinctItems()) {
                if (this.NumberOfCopies(item) != otherBag.NumberOfCopies(item))
                    return false;
            }

            return true;
        }

        /// <summary>
        /// Determines if this bag is a superset of another bag. Neither bag is modified.
        /// This bag is a superset of <paramref name="otherBag"/> if every element in
        /// <paramref name="otherBag"/> is also in this bag, at least the same number of
        /// times.
        /// </summary>
        /// <remarks>IsSupersetOf is computed in time O(M), where M is the number of unique items in 
        /// <paramref name="otherBag"/>.</remarks>
        /// <param name="otherBag">Bag to compare to.</param>
        /// <returns>True if this is a superset of <paramref name="otherBag"/>.</returns>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public bool IsSupersetOf(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

            if (otherBag.Count > this.Count)
                return false;     // Can't be a superset of a bigger set

            // Check each item in the other set to make sure it is in this set.
            foreach (T item in otherBag.DistinctItems()) {
                if (this.NumberOfCopies(item) < otherBag.NumberOfCopies(item))
                    return false;
            }

            return true;
        }

        /// <summary>
        /// Determines if this bag is a proper superset of another bag. Neither bag is modified.
        /// This bag is a proper superset of <paramref name="otherBag"/> if every element in
        /// <paramref name="otherBag"/> is also in this bag, at least the same number of
        /// times. Additional, this bag must have strictly more items than <paramref name="otherBag"/>.
        /// </summary>
        /// <remarks>IsProperSupersetOf is computed in time O(M), where M is the number of unique items in 
        /// <paramref name="otherBag"/>.</remarks>
        /// <param name="otherBag">Set to compare to.</param>
        /// <returns>True if this is a proper superset of <paramref name="otherBag"/>.</returns>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public bool IsProperSupersetOf(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

            if (otherBag.Count >= this.Count)
                return false;     // Can't be a proper superset of a bigger or equal set

            return IsSupersetOf(otherBag);
        }

        /// <summary>
        /// Determines if this bag is a subset of another ba11 items in this bag.
        /// </summary>
        /// <param name="otherBag">Bag to compare to.</param>
        /// <returns>True if this is a subset of <paramref name="otherBag"/>.</returns>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public bool IsSubsetOf(Bag<T> otherBag)
        {
            return otherBag.IsSupersetOf(this);
        }

        /// <summary>
        /// Determines if this bag is a proper subset of another bag. Neither bag is modified.
        /// This bag is a subset of <paramref name="otherBag"/> if every element in this bag
        /// is also in <paramref name="otherBag"/>, at least the same number of
        /// times. Additional, this bag must have strictly fewer items than <paramref name="otherBag"/>.
        /// </summary>
        /// <remarks>IsProperSubsetOf is computed in time O(N), where N is the number of unique items in this bag.</remarks>
        /// <param name="otherBag">Bag to compare to.</param>
        /// <returns>True if this is a proper subset of <paramref name="otherBag"/>.</returns>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public bool IsProperSubsetOf(Bag<T> otherBag)
        {
            return otherBag.IsProperSupersetOf(this);
        }

        /// <summary>
        /// Determines if this bag is disjoint from another bag. Two bags are disjoint
        /// if no item from one set is equal to any item in the other bag.
        /// </summary>
        /// <remarks>
        /// <para>The answer is computed in time O(N), where N is the size of the smaller set.</para>
        /// </remarks>
        /// <param name="otherBag">Bag to check disjointness with.</param>
        /// <returns>True if the two bags are disjoint, false otherwise.</returns>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public bool IsDisjointFrom(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);
            Bag<T> smaller, larger;
            if (otherBag.Count > this.Count) {
                smaller = this; larger = otherBag;
            }
            else {
                smaller = otherBag; larger = this;
            }

            foreach (T item in smaller.DistinctItems()) {
                if (larger.Contains(item))
                    return false;
            }

            return true;
        }

        /// <summary>
        /// Computes the union of this bag with another bag. The union of two bags
        /// is all items from both of the bags. If an item appears X times in one bag,
        /// and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives
        /// the union of the two bags, the other bag is unchanged.
        /// </summary>
        /// <remarks>
        /// <para>The union of two bags is computed in time O(M+N), where M and N are the size of the 
        /// two bags.</para>
        /// </remarks>
        /// <param name="otherBag">Bag to union with.</param>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public void UnionWith(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

            if (otherBag == this)
                return;             // Nothing to do

            int copiesInThis, copiesInOther;

            // Enumerate each of the items in the other bag. Add items that need to be
            // added to this bag.
            foreach (T item in otherBag.DistinctItems()) {
                copiesInThis = this.NumberOfCopies(item);
                copiesInOther = otherBag.NumberOfCopies(item);

                if (copiesInOther > copiesInThis)
                    ChangeNumberOfCopies(item, copiesInOther);
            } 
        }

        /// <summary>
        /// Computes the union of this bag with another bag. The union of two bags
        /// is all items from both of the bags.  If an item appears X times in one bag,
        /// and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is 
        /// created with the union of the bags and is returned. This bag and the other bag 
        /// are unchanged.
        /// </summary>
        /// <remarks>
        /// <para>The union of two bags is computed in time O(M+N), where M and N are the size of the two bags.</para>
        /// </remarks>
        /// <param name="otherBag">Bag to union with.</param>
        /// <returns>The union of the two bags.</returns>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public Bag<T> Union(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

            Bag<T> smaller, larger, result;
            if (otherBag.Count > this.Count) {
                smaller = this; larger = otherBag;
            }
            else {
                smaller = otherBag; larger = this;
            }

            result = larger.Clone();
            result.UnionWith(smaller);
            return result; 
        }

        /// <summary>
        /// Computes the sum of this bag with another bag. The sum of two bags
        /// is all items from both of the bags. If an item appears X times in one bag,
        /// and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives
        /// the sum of the two bags, the other bag is unchanged.
        /// </summary>
        /// <remarks>
        /// <para>The sum of two bags is computed in time O(M), where M is the size of the 
        /// other bag..</para>
        /// </remarks>
        /// <param name="otherBag">Bag to sum with.</param>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public void SumWith(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

            if (this == otherBag) {
                // Not very efficient, but an uncommon case.
                AddMany(otherBag);
                return;
            }

            int copiesInThis, copiesInOther;

            // Enumerate each of the items in the other bag. Add items that need to be
            // added to this bag.
            foreach (T item in otherBag.DistinctItems()) {
                copiesInThis = this.NumberOfCopies(item);
                copiesInOther = otherBag.NumberOfCopies(item);

                ChangeNumberOfCopies(item, copiesInThis + copiesInOther);
            }
        }

        /// <summary>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线91免费看| 五月激情综合网| 亚洲精品国产高清久久伦理二区| 不卡电影一区二区三区| 精品一区二区在线观看| 韩国一区二区三区| 国产69精品久久99不卡| 不卡一区二区三区四区| 97久久超碰国产精品电影| 欧美色精品在线视频| 欧美日韩久久久| 国产a视频精品免费观看| 亚洲欧美国产77777| 三级亚洲高清视频| 国产精品69毛片高清亚洲| 欧美一区在线视频| 欧美日韩精品免费| 中文字幕乱码亚洲精品一区| 亚洲欧美色图小说| 久久精品国产精品青草| 91在线视频观看| 欧美一区二区在线视频| 国产精品第五页| 国产在线精品一区二区不卡了| 国产欧美视频一区二区三区| 国产主播一区二区| 不卡电影一区二区三区| 精品久久久久香蕉网| 亚洲综合一区二区三区| 亚洲欧美电影一区二区| 国产99久久久久久免费看农村| 欧美午夜一区二区| 亚洲人成精品久久久久久| 国产麻豆视频精品| 欧美一区二区三区四区高清| 一区二区三区日韩欧美精品| 国产精品一区二区果冻传媒| 91精品免费在线| 一区二区三区.www| 91一区二区三区在线观看| 久久综合久久99| 九九视频精品免费| 日韩欧美在线不卡| 日本中文字幕一区二区有限公司| eeuss国产一区二区三区| 国产清纯白嫩初高生在线观看91 | 国产嫩草影院久久久久| 久久精品国产一区二区三| 欧美一区二区日韩一区二区| 在线精品视频免费观看| 欧美精品tushy高清| bt7086福利一区国产| 91精品国产91久久久久久一区二区 | 亚洲裸体在线观看| 色综合网色综合| 亚洲一区影音先锋| 日韩精品一区二区三区在线| 国内成人自拍视频| 亚洲免费色视频| 欧美精品aⅴ在线视频| 精品在线播放午夜| ...xxx性欧美| 欧美成人激情免费网| 不卡一二三区首页| 亚洲一区二区三区在线看| 日韩一二三四区| 成+人+亚洲+综合天堂| 毛片不卡一区二区| 亚洲品质自拍视频| 欧美精品三级日韩久久| 成人午夜电影久久影院| 国产老妇另类xxxxx| 亚洲激情综合网| 国产偷国产偷亚洲高清人白洁| 99精品黄色片免费大全| 久久99精品网久久| 午夜一区二区三区视频| 国产精品美女久久久久高潮| 7777精品伊人久久久大香线蕉完整版 | 久久国产精品99精品国产 | 国产精品888| 日韩va欧美va亚洲va久久| 欧美成人一区二区| 91激情在线视频| 一本到不卡免费一区二区| 国产精品一级黄| 国产成人亚洲综合a∨婷婷 | 日韩一区二区免费高清| 成人午夜电影久久影院| 国产精品一区二区果冻传媒| 秋霞午夜鲁丝一区二区老狼| 亚洲一区二区三区四区的| 日韩一级在线观看| 91精品国产福利在线观看| 欧美成人免费网站| 久久精品亚洲国产奇米99| 国产日韩精品一区二区浪潮av| 精品久久国产97色综合| 久久久久久毛片| 国产精品久久久久一区| 最新不卡av在线| 亚洲色图制服诱惑| 国产人成一区二区三区影院| 精品少妇一区二区三区日产乱码 | 国产精品久久久久久久裸模| 国产精品视频九色porn| 国产精品亲子乱子伦xxxx裸| 亚洲人成在线观看一区二区| 中文字幕一区二区三区四区不卡 | 久久一区二区视频| 亚洲你懂的在线视频| 亚洲色欲色欲www在线观看| 日本午夜一区二区| 夫妻av一区二区| 在线精品亚洲一区二区不卡| 日韩视频在线观看一区二区| 国产精品久久久久一区二区三区共| 亚洲蜜臀av乱码久久精品| 午夜精品影院在线观看| 麻豆精品一区二区av白丝在线| 蜜臀精品一区二区三区在线观看| 久久国产精品99久久人人澡| 青青草伊人久久| 色av一区二区| 中文字幕久久午夜不卡| 激情国产一区二区| 欧美va亚洲va香蕉在线| 亚洲女同女同女同女同女同69| 亚洲一区二区三区四区不卡| 91精品国产高清一区二区三区 | 成人手机电影网| 久久精品欧美一区二区三区不卡| 亚洲欧美偷拍三级| 国产精品亚洲午夜一区二区三区| 欧美日韩国产电影| 偷拍日韩校园综合在线| 欧美日韩国产高清一区二区三区| 亚洲精品日日夜夜| 日本精品免费观看高清观看| 中文字幕在线观看不卡视频| 国产suv精品一区二区883| 欧美精品一区二区三区高清aⅴ| 亚洲午夜久久久久久久久电影院| 成人少妇影院yyyy| 国产精品黄色在线观看| 懂色一区二区三区免费观看| 亚洲色图清纯唯美| 国产成人精品免费| 亚洲免费在线视频一区 二区| 欧美日韩一级片网站| 麻豆精品视频在线| 99视频国产精品| 亚洲电影一级黄| 精品视频全国免费看| 一二三四社区欧美黄| 8v天堂国产在线一区二区| 精品一区二区三区在线播放| 久久久久久久久蜜桃| 99久免费精品视频在线观看| 中文字幕一区二区三区四区不卡| 欧美影院一区二区三区| 蜜桃视频在线观看一区| 久久综合色播五月| 国产一区在线观看麻豆| 亚洲一区在线观看视频| 久久久久久久久久久久久女国产乱| 成人午夜看片网址| 国产精品视频一二三区| 色先锋aa成人| 91亚洲精品一区二区乱码| 奇米影视一区二区三区| 亚洲aⅴ怡春院| 亚洲成人自拍一区| 香蕉加勒比综合久久 | 亚洲已满18点击进入久久| 一区二区久久久| 国产精品久久午夜夜伦鲁鲁| 91浏览器在线视频| 国产精品乱子久久久久| 国产在线精品一区二区不卡了 | 综合久久给合久久狠狠狠97色| 色婷婷国产精品综合在线观看| 婷婷久久综合九色综合绿巨人| 久久亚洲一区二区三区四区| 93久久精品日日躁夜夜躁欧美| 国产性色一区二区| 一区二区三区小说| 成人一区二区视频| 欧美激情一区二区三区蜜桃视频| 色婷婷综合在线| 美腿丝袜在线亚洲一区| 国产精品传媒在线| 国产精品午夜免费| 久久精品人人做人人爽人人| 欧美一二三区在线| 国产成人日日夜夜| 国产69精品一区二区亚洲孕妇| 欧美精品一区二区三区视频 | 国产99久久久国产精品潘金| 午夜精品一区在线观看|