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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bag.cs

?? C#寫的類似于STL的集合類,首先是C#編寫,可以用于.net變程.
?? CS
?? 第 1 頁 / 共 4 頁
字號:
        /// Computes the sum of this bag with another bag. he 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. A new bag is 
        /// created with the sum of the bags and is returned. This bag and the other bag 
        /// are unchanged.
        /// </summary>
        /// <remarks>
        /// <para>The sum of two bags is computed in time O(M + N log M), where M is the size of the 
        /// larger bag, and N is the size of the smaller bag.</para>
        /// </remarks>
        /// <param name="otherBag">Bag to sum with.</param>
        /// <returns>The sum 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> Sum(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.SumWith(smaller);
            return result;
        }

        /// <summary>
        /// Computes the intersection of this bag with another bag. The intersection of two bags
        /// is all items that appear in 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 Minimum(X,Y) times. This bag receives
        /// the intersection of the two bags, the other bag is unchanged.
        /// </summary>
        /// <remarks>
        /// <para>When equal items appear in both bags, the intersection will include an arbitrary choice of one of the
        /// two equal items.</para>
        /// <para>The intersection of two bags is computed in time O(N), where N is the size of the smaller bag.</para>
        /// </remarks>
        /// <param name="otherBag">Bag to intersection with.</param>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public void IntersectionWith(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

            hash.StopEnumerations();

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

            KeyValuePair<T,int> dummy;
            Hash<KeyValuePair<T, int>> newHash = new Hash<KeyValuePair<T, int>>(equalityComparer);
            int newCount = 0;
            int copiesInSmaller, copiesInLarger, copies;

            // Enumerate each of the items in the smaller bag. Add items that need to be
            // added to the intersection.
            foreach (T item in smaller.DistinctItems()) {
                copiesInLarger = larger.NumberOfCopies(item);
                copiesInSmaller = smaller.NumberOfCopies(item);
                copies = Math.Min(copiesInLarger, copiesInSmaller);
                if (copies > 0) {
                    newHash.Insert(NewPair(item, copies), true, out dummy);
                    newCount += copies;
                }
            }

            hash = newHash;
            count = newCount;
        }

        /// <summary>
        /// Computes the intersection of this bag with another bag. The intersection of two bags
        /// is all items that appear in both of the bags. If an item appears X times in one bag,
        /// and Y times in the other bag, the intersection contains the item Minimum(X,Y) times. A new bag is 
        /// created with the intersection of the bags and is returned. This bag and the other bag 
        /// are unchanged.
        /// </summary>
        /// <remarks>
        /// <para>When equal items appear in both bags, the intersection will include an arbitrary choice of one of the
        /// two equal items.</para>
        /// <para>The intersection of two bags is computed in time O(N), where N is the size of the smaller bag.</para>
        /// </remarks>
        /// <param name="otherBag">Bag to intersection with.</param>
        /// <returns>The intersection 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> Intersection(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

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

            int copiesInSmaller, copiesInLarger, copies;

            // Enumerate each of the items in the smaller bag. Add items that need to be
            // added to the intersection.
            result = new Bag<T>(keyEqualityComparer);
            foreach (T item in smaller.DistinctItems()) {
                copiesInLarger = larger.NumberOfCopies(item);
                copiesInSmaller = smaller.NumberOfCopies(item);
                copies = Math.Min(copiesInLarger, copiesInSmaller);
                if (copies > 0) 
                    result.ChangeNumberOfCopies(item, copies);
            }

            return result; 
        }

        /// <summary>
        /// Computes the difference of this bag with another bag. The difference of these two bags
        /// is all items that appear in this bag, but not in <paramref name="otherBag"/>. If an item appears X times in this bag,
        /// and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). This bag receives
        /// the difference of the two bags; the other bag is unchanged.
        /// </summary>
        /// <remarks>
        /// <para>The difference 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 difference with.</param>
        /// <exception cref="InvalidOperationException">This bag and <paramref name="otherBag"/> don't use the same method for comparing items.</exception>
        public void DifferenceWith(Bag<T> otherBag)
        {
            CheckConsistentComparison(otherBag);

            if (this == otherBag) {
                Clear();
                return;
            }

            int copiesInThis, copiesInOther, copies;

            // Enumerate each of the items in the other bag. Remove items that need to be
            // removed from this bag.
            foreach (T item in otherBag.DistinctItems()) {
                copiesInThis = this.NumberOfCopies(item);
                copiesInOther = otherBag.NumberOfCopies(item);
                copies = copiesInThis - copiesInOther;
                if (copies < 0)
                    copies = 0;

                ChangeNumberOfCopies(item, copies);
            }
        }

        /// <summary>
        /// Computes the difference of this bag with another bag. The difference of these two bags
        /// is all items that appear in this bag, but not in <paramref name="otherBag"/>. If an item appears X times in this bag,
        /// and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X).  A new bag is 
        /// created with the difference of the bags and is returned. This bag and the other bag 
        /// are unchanged.
        /// </summary>
        /// <remarks>
        /// <para>The difference 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 difference with.</param>
        /// <returns>The difference 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> Difference(Bag<T> otherBag)
        {
            Bag<T> result;

            CheckConsistentComparison(otherBag);

            result = this.Clone();
            result.DifferenceWith(otherBag);
            return result; 
        }

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

            if (this == otherBag) {
                Clear();
                return;
            }

            int copiesInThis, copiesInOther, copies;

            // 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);
                copies = Math.Abs(copiesInThis - copiesInOther);

                if (copies != copiesInThis)
                    ChangeNumberOfCopies(item, copies);
            }
        }

        /// <summary>
        /// Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags
        /// is all items that appear in either of the bags, but not both. If an item appears X times in one bag,
        /// and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. A new bag is 
        /// created with the symmetric difference of the bags and is returned. This bag and the other bag 
        /// are unchanged.
        /// </summary>
        /// <remarks>
        /// <para>The symmetric difference of two bags is computed in time O(M + N), where M is the size of the 
        /// larger bag, and N is the size of the smaller bag.</para>
        /// </remarks>
        /// <param name="otherBag">Bag to symmetric difference with.</param>
        /// <returns>The symmetric difference 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> SymmetricDifference(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.SymmetricDifferenceWith(smaller);
            return result;
        }

        #endregion Set operations
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一二三专区| 亚洲黄色av一区| 综合av第一页| 国内成+人亚洲+欧美+综合在线 | 夜夜嗨av一区二区三区网页| 日韩av一区二| 日本韩国精品在线| 国产午夜精品一区二区三区四区| 一区二区不卡在线视频 午夜欧美不卡在 | 亚洲福利一二三区| 成人av免费在线播放| 欧美日韩精品一区视频| 国产精品久久毛片av大全日韩| 美腿丝袜亚洲色图| 欧美亚洲国产怡红院影院| 国产色综合一区| 久久精品国产免费| 4438x亚洲最大成人网| 亚洲免费在线观看| 成人av免费在线播放| 欧美激情一区二区三区全黄| 久久精品国产久精国产| 日韩一级在线观看| 日韩精品一级中文字幕精品视频免费观看| av亚洲精华国产精华| 久久久精品国产免大香伊| 青青草一区二区三区| 538在线一区二区精品国产| 亚洲va欧美va天堂v国产综合| 色婷婷av一区二区三区之一色屋| 成人免费一区二区三区视频| 成人av影院在线| 国产欧美一区二区精品久导航 | 天堂av在线一区| 欧美精品欧美精品系列| 亚洲国产中文字幕| 精品视频全国免费看| 亚洲成人激情自拍| 欧美一区二区免费视频| 麻豆精品视频在线| 久久久国产午夜精品| 精品亚洲aⅴ乱码一区二区三区| 欧美一区二区三区系列电影| 美腿丝袜亚洲综合| 中文欧美字幕免费| 成人动漫在线一区| 一区二区三区在线视频观看| 欧美在线免费观看视频| 香蕉加勒比综合久久| 欧美肥大bbwbbw高潮| 久久国产精品色| 久久五月婷婷丁香社区| 国产91精品一区二区| 中文字幕一区二区三区色视频| 色悠悠久久综合| 午夜在线成人av| 精品少妇一区二区三区免费观看| 国产激情精品久久久第一区二区| 国产精品卡一卡二| 欧美日韩国产高清一区二区| 久久国产精品免费| 国产精品国模大尺度视频| 在线亚洲+欧美+日本专区| 图片区小说区国产精品视频| 欧美精品一区二区三区蜜臀| 91天堂素人约啪| 喷水一区二区三区| 亚洲日本电影在线| 精品日韩在线观看| 在线观看视频91| 国产精品一区免费视频| 亚洲欧美视频在线观看视频| 911精品国产一区二区在线| 国产麻豆一精品一av一免费 | 国产一区二区三区四区五区美女 | 欧美午夜在线观看| 国内精品国产三级国产a久久| 最新中文字幕一区二区三区| 欧美一区二区日韩| 91蜜桃网址入口| 加勒比av一区二区| 亚洲一级片在线观看| 国产欧美日韩综合| 欧美一二三四在线| 91蜜桃婷婷狠狠久久综合9色| 国产一区福利在线| 亚洲第一福利一区| 成人欧美一区二区三区在线播放| 欧美一区日韩一区| 欧美视频在线观看一区| 成人aaaa免费全部观看| 麻豆精品一区二区综合av| 一个色妞综合视频在线观看| 精品国产免费一区二区三区四区 | 日韩精品一区二区三区视频在线观看 | 99精品久久免费看蜜臀剧情介绍| 天天av天天翘天天综合网| 国产精品午夜免费| 国产日韩精品久久久| 日韩欧美色综合网站| 欧美日韩亚洲综合一区二区三区| 国产91露脸合集magnet| 狠狠网亚洲精品| 日韩高清电影一区| 亚洲成人激情av| 亚洲地区一二三色| 一区二区三区日韩欧美| 国产精品视频yy9299一区| 久久亚洲一区二区三区四区| 欧美一区二区视频在线观看2020| 精品视频一区三区九区| 欧美色图免费看| 欧美日韩亚洲国产综合| 一本色道亚洲精品aⅴ| 国产高清精品久久久久| 国产精品一区二区三区乱码| 免费成人在线网站| 久久成人久久鬼色| 国产麻豆精品视频| 国模无码大尺度一区二区三区 | 亚洲激情男女视频| 伊人色综合久久天天人手人婷| 国产精品久久久久aaaa樱花 | 色综合久久99| 欧美视频自拍偷拍| 91精品国产手机| 精品奇米国产一区二区三区| 欧美电影免费观看高清完整版在线| 91麻豆精品国产91久久久资源速度| 欧美一区二区视频在线观看2022| 日韩免费视频一区二区| 日韩免费高清电影| 国产欧美精品一区二区三区四区| 欧美高清一级片在线观看| 国产欧美日本一区视频| 中文字幕欧美一| 亚洲国产综合人成综合网站| 美女一区二区视频| 激情欧美一区二区三区在线观看| 九九久久精品视频| 不卡一区二区三区四区| 欧洲中文字幕精品| 日韩欧美成人一区| 国产精品国产三级国产专播品爱网| 日韩美女视频一区| 美女视频免费一区| 国产v日产∨综合v精品视频| 99热这里都是精品| 欧美一级欧美一级在线播放| 久久久久久影视| 亚洲国产视频直播| 九九精品视频在线看| 91丨porny丨户外露出| 日韩一区二区免费视频| 国产精品国产a| 青青草国产精品亚洲专区无| 成人av网站大全| 日韩欧美国产电影| 亚洲精品日韩一| 国产精品一二三四五| 欧美日韩国产一级片| 国产精品久久久久久久裸模| 日本不卡123| 欧洲激情一区二区| 国产精品三级视频| 激情深爱一区二区| 欧美军同video69gay| 国产精品精品国产色婷婷| 美女在线一区二区| 欧美日韩国产综合草草| 中文字幕中文字幕在线一区| 久久爱www久久做| 一本大道av伊人久久综合| 久久精品夜夜夜夜久久| 婷婷开心激情综合| 色偷偷88欧美精品久久久| 久久综合av免费| 日韩不卡在线观看日韩不卡视频| 91亚洲精品乱码久久久久久蜜桃| 欧美日韩国产一级| 尤物av一区二区| 99re成人精品视频| 日本一区二区三区高清不卡| 美女一区二区三区在线观看| 欧美人牲a欧美精品| 亚洲综合丁香婷婷六月香| 成人激情图片网| 国产精品无码永久免费888| 日本不卡一区二区三区| 欧美日韩国产一级片| 亚洲精品国产成人久久av盗摄| 国产一区二区不卡老阿姨| 欧美一级黄色大片| 老司机一区二区| 日韩欧美专区在线| 免费成人深夜小野草| 在线不卡的av| 麻豆精品视频在线观看| 4438x成人网最大色成网站| 蜜臀久久99精品久久久久久9|