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

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

?? orderedbag.cs

?? C#寫的類似于STL的集合類,首先是C#編寫,可以用于.net變程.
?? CS
?? 第 1 頁 / 共 5 頁
字號:

        /// <summary>
        /// Determines if this bag contains an item equal to <paramref name="item"/>. The bag
        /// is not changed.
        /// </summary>
        /// <remarks>Searching the bag for an item takes time O(log N), where N is the number of items in the bag.</remarks>
        /// <param name="item">The item to search for.</param>
        /// <returns>True if the bag contains <paramref name="item"/>. False if the bag does not contain <paramref name="item"/>.</returns>
        public sealed override bool Contains(T item)
        {
            T dummy;
            return tree.Find(item, false, false, out dummy);
        }

        /// <summary>
        /// <para>Enumerates all of the items in this bag that are equal to <paramref name="item"/>, according to the 
        /// comparison mechanism that was used when the bag was created. The bag
        /// is not changed.</para>
        /// <para>If the bag does contain an item equal to <paramref name="item"/>, then the enumeration contains
        /// no items.</para>
        /// </summary>
        /// <remarks>Enumeration the items in the bag equal to <paramref name="item"/> takes time O(log N + M), where N 
        /// is the total number of items in the bag, and M is the number of items equal to <paramref name="item"/>.</remarks>
        /// <param name="item">The item to search for.</param>
        /// <returns>An IEnumerable&lt;T&gt; that enumerates all the items in the bag equal to <paramref name="item"/>. </returns>
        public IEnumerable<T> GetEqualItems(T item)
        {
            return tree.EnumerateRange(tree.EqualRangeTester(item));  
        }

        /// <summary>
        /// Enumerates all the items in the bag, but enumerates equal items
        /// just once, even if they occur multiple times in the bag.
        /// </summary>
        /// <remarks>If the bag is changed while items are being enumerated, the
        /// enumeration will terminate with an InvalidOperationException.</remarks>
        /// <returns>An IEnumerable&lt;T&gt; that enumerates the unique items.</returns>
        public IEnumerable<T> DistinctItems()
        {
            T previous = default(T);
            bool atBeginning = true;

            // Enumerate the items, but only yield ones not equal to the previous one.
            foreach (T item in this) {
                if (atBeginning || comparer.Compare(item, previous) != 0)
                    yield return item;
                previous = item;
                atBeginning = false;
            }
        }

        #endregion

        #region Index by sorted order

        /// <summary>
        /// Get the item by its index in the sorted order. The smallest item has index 0,
        /// the next smallest item has index 1, and the largest item has index Count-1. 
        /// </summary>
        /// <remarks>The indexer takes time O(log N), which N is the number of items in 
        /// the set.</remarks>
        /// <param name="index">The index to get the item by.</param>
        /// <returns>The item at the given index.</returns>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is
        /// less than zero or greater than or equal to Count.</exception>
        public T this[int index]
        {
            get
            {
                if (index < 0 || index >= Count)
                    throw new ArgumentOutOfRangeException("index");

                return tree.GetItemByIndex(index);
            }
        }

        /// <summary>
        /// Get the index of the given item in the sorted order. The smallest item has index 0,
        /// the next smallest item has index 1, and the largest item has index Count-1. If multiple
        /// equal items exist, the largest index of the equal items is returned.
        /// </summary>
        /// <remarks>Finding the index takes time O(log N), which N is the number of items in 
        /// the set.</remarks>
        /// <param name="item">The item to get the index of.</param>
        /// <returns>The index of the last item in the sorted bag equal to <paramref name="item"/>, or -1 if the item is not present
        /// in the set.</returns>
        public int LastIndexOf(T item)
        {
            return tree.FindIndex(item, false);
        }

        /// <summary>
        /// Get the index of the given item in the sorted order. The smallest item has index 0,
        /// the next smallest item has index 1, and the largest item has index Count-1. If multiple
        /// equal items exist, the smallest index of the equal items is returned.
        /// </summary>
        /// <remarks>Finding the index takes time O(log N), which N is the number of items in 
        /// the set.</remarks>
        /// <param name="item">The item to get the index of.</param>
        /// <returns>The index of the first item in the sorted bag equal to <paramref name="item"/>, or -1 if the item is not present
        /// in the set.</returns>
        public int IndexOf(T item)
        {
            return tree.FindIndex(item, true);
        }

        #endregion

        #region Adding elements

        /// <summary>
        /// Adds a new item to the bag. Since bags can contain duplicate items, the item 
        /// is added even if the bag already contains an item equal to <paramref name="item"/>. In
        /// this case, the new item is placed after all equal items already present in the bag.
        /// </summary>
        /// <remarks>
        /// <para>Adding an item takes time O(log N), where N is the number of items in the bag.</para></remarks>
        /// <param name="item">The item to add to the bag.</param>
        public sealed override void Add(T item)
        {
            T dummy;
            tree.Insert(item, DuplicatePolicy.InsertLast, out dummy);
        }

        /// <summary>
        /// Adds all the items in <paramref name="collection"/> to the bag. 
        /// </summary>
        /// <remarks>
        /// <para>Adding the collection takes time O(M log N), where N is the number of items in the bag, and M is the 
        /// number of items in <paramref name="collection"/>.</para></remarks>
        /// <param name="collection">A collection of items to add to the bag.</param>
        /// <exception cref="ArgumentNullException"><paramref name="collection"/> is null.</exception>
        public void AddMany(IEnumerable<T> collection)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");

            // If we're adding ourselves, we need to copy to a separate array to avoid modification
            // during enumeration.
            if (this == collection)
                collection = this.ToArray();

            foreach (T item in collection)
                Add(item);
        }

        #endregion Adding elements

        #region Removing elements

        /// <summary>
        /// Searches the bag for one item equal to <paramref name="item"/>, and if found,
        /// removes it from the bag. If not found, the bag is unchanged. If more than one item
        /// equal to <paramref name="item"/>, the item that was last inserted is removed.
        /// </summary>
        /// <remarks>
        /// <para>Equality between items is determined by the comparison instance or delegate used
        /// to create the bag.</para>
        /// <para>Removing an item from the bag takes time O(log N), where N is the number of items in the bag.</para></remarks>
        /// <param name="item">The item to remove.</param>
        /// <returns>True if <paramref name="item"/> was found and removed. False if <paramref name="item"/> was not in the bag.</returns>
        public sealed override bool Remove(T item)
        {
            T dummy;
            return tree.Delete(item, false, out dummy);
        }

        /// <summary>
        /// Searches the bag for all items equal to <paramref name="item"/>, and 
        /// removes all of them from the bag. If not found, the bag is unchanged.
        /// </summary>
        /// <remarks>
        /// <para>Equality between items is determined by the comparison instance or delegate used
        /// to create the bag.</para>
        /// <para>RemoveAllCopies() takes time O(M log N), where N is the total number of items in the bag, and M is
        /// the number of items equal to <paramref name="item"/>.</para></remarks>
        /// <param name="item">The item to remove.</param>
        /// <returns>The number of copies of <paramref name="item"/> that were found and removed. </returns>
        public int RemoveAllCopies(T item)
        {
            return tree.DeleteRange(tree.EqualRangeTester(item));
        }

        /// <summary>
        /// Removes all the items in <paramref name="collection"/> from the bag. Items not
        /// present in the bag are ignored.
        /// </summary>
        /// <remarks>
        /// <para>Equality between items is determined by the comparison instance or delegate used
        /// to create the bag.</para>
        /// <para>Removing the collection takes time O(M log N), where N is the number of items in the bag, and M is the 
        /// number of items in <paramref name="collection"/>.</para></remarks>
        /// <param name="collection">A collection of items to remove from the bag.</param>
        /// <returns>The number of items removed from the bag.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="collection"/> is null.</exception>
        public int RemoveMany(IEnumerable<T> collection)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");

            int count = 0;

            if (collection == this) {
                count = Count;
                Clear();            // special case, otherwise we will throw.
            }
            else {
                foreach (T item in collection) {
                    if (Remove(item))
                        ++count;
                }
            }

            return count;
        }

        /// <summary>
        /// Removes all items from the bag.
        /// </summary>
        /// <remarks>Clearing the bag takes a constant amount of time, regardless of the number of items in it.</remarks>
        public sealed override void Clear()
        {
            tree.StopEnumerations();  // Invalidate any enumerations.

            // The simplest and fastest way is simply to throw away the old tree and create a new one.
            tree = new RedBlackTree<T>(comparer);
        }

        #endregion Removing elements

        #region First/last items

        /// <summary>
        /// If the collection is empty, throw an invalid operation exception.
        /// </summary>
        /// <exception cref="InvalidOperationException">The bag is empty.</exception>
        private void CheckEmpty()
        {
            if (Count == 0)
                throw new InvalidOperationException(Strings.CollectionIsEmpty);
        }

        /// <summary>
        /// Returns the first item in the bag: the item
        /// that would appear first if the bag was enumerated. This is also
        /// the smallest item in the bag.
        /// </summary>
        /// <remarks>GetFirst() takes time O(log N), where N is the number of items in the bag.</remarks>
        /// <returns>The first item in the bag. If more than one item
        /// is smallest, the first one added is returned.</returns>
        /// <exception cref="InvalidOperationException">The bag is empty.</exception>
        public T GetFirst()
        {
            T item;
            CheckEmpty();
            tree.FirstItemInRange(tree.EntireRangeTester, out item);
            return item;
        }

        /// <summary>
        /// Returns the last item in the bag: the item
        /// that would appear last if the bag was enumerated. This is also the largest
        /// item in the bag.
        /// </summary>
        /// <remarks>GetLast() takes time O(log N), where N is the number of items in the bag.</remarks>
        /// <returns>The last item in the bag. If more than one item
        /// is largest, the last one added is returned.</returns>
        /// <exception cref="InvalidOperationException">The bag is empty.</exception>
        public T GetLast()

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产伦一区二区三区观看体验| 亚洲制服丝袜av| 久久久影院官网| 亚洲视频免费观看| 日本中文字幕一区二区有限公司| 激情综合色播五月| 99久久精品国产精品久久| 777午夜精品免费视频| 一区在线播放视频| 国产精品一二三在| 91精品国产乱| 午夜影视日本亚洲欧洲精品| 波多野结衣一区二区三区| 精品久久99ma| 免费的国产精品| 欧美日韩亚洲综合在线| 专区另类欧美日韩| 丁香六月综合激情| 久久久久久久久一| 精品亚洲成a人在线观看| 欧美肥胖老妇做爰| 香蕉久久夜色精品国产使用方法 | 综合av第一页| 国产激情视频一区二区在线观看| 欧美一级在线视频| 日韩精品高清不卡| 欧美视频完全免费看| jlzzjlzz欧美大全| 国产精品嫩草影院com| 国产精品一区二区黑丝| 欧美精品一区二区久久久| 久久99国产精品久久99 | 亚洲黄色尤物视频| 91小宝寻花一区二区三区| 国产精品美女久久久久久久久 | 久久97超碰色| 26uuu欧美日本| 国产激情视频一区二区三区欧美| 久久亚洲私人国产精品va媚药| 久久99国内精品| 久久精品亚洲乱码伦伦中文| 国产精品99精品久久免费| 久久影院视频免费| 成人在线视频一区二区| 亚洲欧美一区二区在线观看| 色婷婷综合久久久中文一区二区| 一区二区三区国产精华| 日本二三区不卡| 五月天激情综合| 精品日韩在线观看| 国产美女精品人人做人人爽| 日本一区二区成人在线| 91麻豆免费视频| 婷婷开心激情综合| 欧美精品一区二区久久婷婷| 91免费国产视频网站| 一本色道久久综合亚洲aⅴ蜜桃| 亚洲精品乱码久久久久久| 欧美视频日韩视频在线观看| 另类的小说在线视频另类成人小视频在线 | 精品一区二区三区影院在线午夜 | 国产99精品视频| 亚洲精品精品亚洲| 日韩视频在线观看一区二区| 狠狠色2019综合网| 亚洲欧美日韩国产手机在线 | 91极品美女在线| 免费观看在线色综合| 亚洲国产精品成人综合| 一本一道综合狠狠老| 免费精品99久久国产综合精品| 国产人伦精品一区二区| 欧美天堂亚洲电影院在线播放| 久草精品在线观看| 亚洲精品日日夜夜| 日韩精品一区二区三区在线| 色综合网色综合| 久久66热偷产精品| 亚洲五月六月丁香激情| 国产亚洲一二三区| 91精品国产色综合久久不卡蜜臀 | 亚洲天堂中文字幕| 91麻豆精品国产无毒不卡在线观看| 久久久午夜电影| 欧美婷婷六月丁香综合色| 国产一区二区美女诱惑| 亚洲成人高清在线| 国产亚洲污的网站| 欧美一级欧美三级在线观看| 色综合欧美在线视频区| 捆绑变态av一区二区三区| 亚洲乱码日产精品bd| 久久免费看少妇高潮| 9191精品国产综合久久久久久| 成人午夜碰碰视频| 国产一区二区影院| 蜜桃av一区二区在线观看| 亚洲自拍偷拍网站| 亚洲天堂成人网| 日韩午夜中文字幕| 日韩天堂在线观看| 99久久99久久精品国产片果冻 | 一区二区不卡在线视频 午夜欧美不卡在| 成人动漫在线一区| 国产在线视频一区二区三区| 亚洲最新在线观看| 亚洲欧洲99久久| 久久婷婷国产综合国色天香| 日韩一区二区三免费高清| 一本久久a久久精品亚洲| 成人美女视频在线观看| 国产精品主播直播| 韩国理伦片一区二区三区在线播放| 亚洲超碰97人人做人人爱| 洋洋av久久久久久久一区| 国产偷v国产偷v亚洲高清| 精品久久99ma| 久久网站热最新地址| www国产成人| 久久久综合九色合综国产精品| 精品久久久久久久久久久院品网| 日韩欧美国产综合| 26uuu国产电影一区二区| 欧美第一区第二区| 久久这里都是精品| 国产亚洲欧美一级| 中文字幕国产一区| 69堂国产成人免费视频| 久久国产精品一区二区| 老司机一区二区| 久久99精品久久久久久久久久久久| 性做久久久久久免费观看| 免费精品视频最新在线| 国产美女在线精品| 99久久精品99国产精品| 在线观看免费一区| 67194成人在线观看| 日韩一区二区精品葵司在线| 精品人在线二区三区| 久久久久9999亚洲精品| 国产精品无人区| 曰韩精品一区二区| 日韩激情在线观看| 国产精品99久久久久久久女警 | 蜜臀91精品一区二区三区| 久久99热这里只有精品| 国产69精品久久777的优势| 成人一区在线观看| 欧美亚洲一区二区在线| 这里只有精品免费| 国产婷婷色一区二区三区四区| 亚洲欧洲av色图| 奇米一区二区三区av| 国产99久久久久| 欧美日韩亚洲综合一区二区三区 | 欧美高清hd18日本| 精品国产乱码久久| 亚洲欧美色综合| 麻豆91免费看| 色综合天天天天做夜夜夜夜做| 欧美一级黄色录像| 国产精品成人一区二区艾草| 午夜久久电影网| 成人精品gif动图一区| 5858s免费视频成人| av激情综合网| 日韩视频一区在线观看| 中文字幕中文字幕中文字幕亚洲无线| 五月天激情综合网| 91香蕉国产在线观看软件| 日韩欧美在线综合网| 亚洲三级小视频| 国产一区欧美一区| 欧美精品九九99久久| 国产精品成人在线观看| 另类欧美日韩国产在线| 欧美中文字幕一区二区三区亚洲| ww久久中文字幕| 理论片日本一区| 欧美精品在线观看一区二区| 综合分类小说区另类春色亚洲小说欧美 | 一本高清dvd不卡在线观看| 精品日韩一区二区三区免费视频| 亚洲第一久久影院| 成人一区二区三区在线观看| 欧美一三区三区四区免费在线看| 亚洲久草在线视频| zzijzzij亚洲日本少妇熟睡| 久久蜜桃香蕉精品一区二区三区| 日韩影视精彩在线| 欧美午夜在线一二页| 亚洲青青青在线视频| 成人国产精品免费观看视频| 久久人人97超碰com| 另类综合日韩欧美亚洲| 欧美疯狂性受xxxxx喷水图片| 亚洲免费观看在线视频| 不卡在线观看av| 国产精品乱人伦| 99这里只有精品|