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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? orderedset.cs

?? C#寫(xiě)的類(lèi)似于STL的集合類(lèi),首先是C#編寫(xiě),可以用于.net變程.
?? CS
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
?//******************************
// Written by Peter Golde
// Copyright (c) 2004-2005, Wintellect
//
// Use and restribution of this code is subject to the license agreement 
// contained in the file "License.txt" accompanying this file.
//******************************

using System;
using System.Collections.Generic;
using System.Collections;

namespace Wintellect.PowerCollections
{
    /// <summary>
    /// OrderedSet&lt;T&gt; is a collection that contains items of type T. 
    /// The item are maintained in a sorted order, and duplicate items are not allowed. Each item has
    /// an index in the set: the smallest item has index 0, the next smallest item has index 1,
    /// and so forth.
    /// </summary>
    /// <remarks>
    /// <p>The items are compared in one of three ways. If T implements IComparable&lt;TKey&gt; or IComparable,
    /// then the CompareTo method of that interface will be used to compare items. Alternatively, a comparison
    /// function can be passed in either as a delegate, or as an instance of IComparer&lt;TKey&gt;.</p>
    /// <p>OrderedSet is implemented as a balanced binary tree. Inserting, deleting, and looking up an
    /// an element all are done in log(N) type, where N is the number of keys in the tree.</p>
    /// <p><see cref="Set&lt;T&gt;"/> is similar, but uses hashing instead of comparison, and does not maintain
    /// the items in sorted order.</p>
    ///</remarks>
    ///<seealso cref="Set&lt;T&gt;"/>
    [Serializable]
    public class OrderedSet<T> : CollectionBase<T>, ICollection<T>, ICloneable
    {
        // The comparer used to compare items. 
        private IComparer<T> comparer;

        // The red-black tree that actually does the work of storing the items.
        private RedBlackTree<T> tree;

        #region Constructors

        /// <summary>
        /// Creates a new OrderedSet. The T must implement IComparable&lt;T&gt;
        /// or IComparable. 
        /// The CompareTo method of this interface will be used to compare items in this set.
        /// </summary>
        ///<remarks>
        /// Items that are null are permitted, and will be sorted before all other items.
        ///</remarks>
        /// <exception cref="InvalidOperationException">T does not implement IComparable&lt;TKey&gt;.</exception>
        public OrderedSet(): 
            this(Comparers.DefaultComparer<T>())
        {
        }

        /// <summary>
        /// Creates a new OrderedSet. The passed delegate will be used to compare items in this set.
        /// </summary>
        /// <param name="comparison">A delegate to a method that will be used to compare items.</param>
        public OrderedSet(Comparison<T> comparison) :
            this(Comparers.ComparerFromComparison<T>(comparison))
        {
        }

        /// <summary>
        /// Creates a new OrderedSet. The Compare method of the passed comparison object
        /// will be used to compare items in this set.
        /// </summary>
        /// <remarks>
        /// The GetHashCode and Equals methods of the provided IComparer&lt;T&gt; will never
        /// be called, and need not be implemented.
        /// </remarks>
        /// <param name="comparer">An instance of IComparer&lt;T&gt; that will be used to compare items.</param>
        public OrderedSet(IComparer<T> comparer)
        {
            if (comparer == null)
                throw new ArgumentNullException("comparer");

            this.comparer = comparer;
            tree = new RedBlackTree<T>(comparer);
        }

        /// <summary>
        /// Creates a new OrderedSet. The T must implement IComparable&lt;T&gt;
        /// or IComparable. 
        /// The CompareTo method of this interface will be used to compare items in this set. The set is
        /// initialized with all the items in the given collection.
        /// </summary>
        ///<remarks>
        /// Items that are null are permitted, and will be sorted before all other items.
        ///</remarks>
        /// <param name="collection">A collection with items to be placed into the OrderedSet.</param>
        /// <exception cref="InvalidOperationException">T does not implement IComparable&lt;TKey&gt;.</exception>
        public OrderedSet(IEnumerable<T> collection): 
            this(collection, Comparers.DefaultComparer<T>())
        {
        }

        /// <summary>
        /// Creates a new OrderedSet. The passed delegate will be used to compare items in this set.
        /// The set is initialized with all the items in the given collection.
        /// </summary>
        /// <param name="collection">A collection with items to be placed into the OrderedSet.</param>
        /// <param name="comparison">A delegate to a method that will be used to compare items.</param>
        public OrderedSet(IEnumerable<T> collection, Comparison<T> comparison):
            this(collection, Comparers.ComparerFromComparison<T>(comparison))
        {
        }

        /// <summary>
        /// Creates a new OrderedSet. The Compare method of the passed comparison object
        /// will be used to compare items in this set. The set is
        /// initialized with all the items in the given collection.
        /// </summary>
        /// <remarks>
        /// The GetHashCode and Equals methods of the provided IComparer&lt;T&gt; will never
        /// be called, and need not be implemented.
        /// </remarks>
        /// <param name="collection">A collection with items to be placed into the OrderedSet.</param>
        /// <param name="comparer">An instance of IComparer&lt;T&gt; that will be used to compare items.</param>
        public OrderedSet(IEnumerable<T> collection, IComparer<T> comparer):
            this(comparer)
        {
            AddMany(collection);
        }

        /// <summary>
        /// Creates a new OrderedSet given a comparer and a tree that contains the data. Used
        /// internally for Clone.
        /// </summary>
        /// <param name="comparer">Comparer for the set.</param>
        /// <param name="tree">Data for the set.</param>
        private OrderedSet(IComparer<T> comparer, RedBlackTree<T> tree)
        {
            this.comparer = comparer;
            this.tree = tree;
        }

        #endregion Constructors

        #region Cloning

        /// <summary>
        /// Makes a shallow clone of this set; i.e., if items of the
        /// set are reference types, then they are not cloned. If T is a value type,
        /// then each element is copied as if by simple assignment.
        /// </summary>
        /// <remarks>Cloning the set takes time O(N), where N is the number of items in the set.</remarks>
        /// <returns>The cloned set.</returns>
        object ICloneable.Clone()
        {
            return this.Clone();     
        }

        /// <summary>
        /// Makes a shallow clone of this set; i.e., if items of the
        /// set are reference types, then they are not cloned. If T is a value type,
        /// then each element is copied as if by simple assignment.
        /// </summary>
        /// <remarks>Cloning the set takes time O(N), where N is the number of items in the set.</remarks>
        /// <returns>The cloned set.</returns>
        public OrderedSet<T> Clone()
        {
            OrderedSet<T> newSet = new OrderedSet<T>(comparer, tree.Clone());
            return newSet;
        }

        /// <summary>
        /// Makes a deep clone of this set. A new set is created with a clone of
        /// each element of this set, by calling ICloneable.Clone on each element. If T is
        /// a value type, then each element is copied as if by simple assignment.
        /// </summary>
        /// <remarks><para>If T is a reference type, it must implement
        /// ICloneable. Otherwise, an InvalidOperationException is thrown.</para>
        /// <para>Cloning the set takes time O(N log N), where N is the number of items in the set.</para></remarks>
        /// <returns>The cloned set.</returns>
        /// <exception cref="InvalidOperationException">T is a reference type that does not implement ICloneable.</exception>
        public OrderedSet<T> CloneContents()
        {
            bool itemIsValueType;
            if (!Util.IsCloneableType(typeof(T), out itemIsValueType))
                throw new InvalidOperationException(string.Format(Strings.TypeNotCloneable, typeof(T).FullName));

            OrderedSet<T> clone = new OrderedSet<T>(comparer);

            // Clone each item, and add it to the new ordered set.
            foreach (T item in this) {
                T itemClone;

                if (itemIsValueType)
                    itemClone = item;
                else {
                    if (item == null)
                        itemClone = default(T);    // Really null, because we know T is a reference type
                    else
                        itemClone = (T)(((ICloneable)item).Clone());
                }

                clone.Add(itemClone);
            }

            return clone;
        }

        #endregion Cloning

        #region Basic collection containment

        /// <summary>
        /// Returns the IComparer&lt;T&gt; used to compare items in this set. 
        /// </summary>
        /// <value>If the set was created using a comparer, that comparer is returned. If the set was
        /// created using a comparison delegate, then a comparer equivalent to that delegate
        /// is returned. Otherwise
        /// the default comparer for T (Comparer&lt;T&gt;.Default) is returned.</value>
        public IComparer<T> Comparer
        {
            get
            {
                return this.comparer;
            }
        }

        /// <summary>
        /// Returns the number of items in the set.
        /// </summary>
        /// <remarks>The size of the set is returned in constant time.</remarks>
        /// <value>The number of items in the set.</value>
        public sealed override int Count
        {
            get {
                return tree.ElementCount;
            }
        }

        /// <summary>
        /// Returns an enumerator that enumerates all the items in the set. 
        /// The items are enumerated in sorted order.
        /// </summary>
        /// <remarks>
        /// <p>Typically, this method is not called directly. Instead the "foreach" statement is used
        /// to enumerate the items, which uses this method implicitly.</p>
        /// <p>If an item is added to or deleted from the set while it is being enumerated, then 
        /// the enumeration will end with an InvalidOperationException.</p>
        /// <p>Enumeration all the items in the set takes time O(N log N), where N is the number
        /// of items in the set.</p>
        /// </remarks>
        /// <returns>An enumerator for enumerating all the items in the OrderedSet.</returns>		
        public sealed override IEnumerator<T> GetEnumerator()
        {
            return tree.GetEnumerator();
        }

        /// <summary>
        /// Determines if this set contains an item equal to <paramref name="item"/>. The set
        /// is not changed.
        /// </summary>
        /// <remarks>Searching the set for an item takes time O(log N), where N is the number of items in the set.</remarks>
        /// <param name="item">The item to search for.</param>
        /// <returns>True if the set contains <paramref name="item"/>. False if the set 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>Determines if this set contains an item equal to <paramref name="item"/>, according to the 
        /// comparison mechanism that was used when the set was created. The set
        /// is not changed.</para>
        /// <para>If the set does contain an item equal to <paramref name="item"/>, then the item from the set is returned.</para>
        /// </summary>
        /// <remarks>Searching the set for an item takes time O(log N), where N is the number of items in the set.</remarks>
        /// <example>
        /// In the following example, the set contains strings which are compared in a case-insensitive manner. 

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女一区二区| 视频一区二区欧美| 中文字幕成人av| 欧美精品一区二区三区蜜桃| 日韩欧美一二三四区| 日韩精品一区二区三区视频在线观看 | 国产精品理论在线观看| 国产视频视频一区| 国产亚洲成aⅴ人片在线观看| 久久众筹精品私拍模特| 久久久久免费观看| 欧美激情在线一区二区三区| 国产精品视频你懂的| 国产精品免费视频一区| 亚洲欧洲美洲综合色网| 亚洲欧美日韩系列| 亚洲成人7777| 免费看黄色91| 国产成人精品免费| 91一区二区三区在线播放| 欧美亚洲一区三区| 日韩视频永久免费| 国产欧美日韩不卡免费| 自拍偷自拍亚洲精品播放| 一区二区理论电影在线观看| 天天影视涩香欲综合网| 久草这里只有精品视频| 成人午夜伦理影院| 欧洲中文字幕精品| 日韩一二三区视频| 国产视频一区在线观看| 亚洲柠檬福利资源导航| 日韩精品每日更新| 国产精品一二三在| 色综合色狠狠天天综合色| 在线综合视频播放| 国产午夜精品久久久久久久| 伊人婷婷欧美激情| 九一九一国产精品| 91一区二区在线| 日韩欧美精品三级| 亚洲人午夜精品天堂一二香蕉| 视频一区二区三区中文字幕| 成人丝袜高跟foot| 555www色欧美视频| 国产精品视频第一区| 亚洲成人动漫一区| 岛国一区二区在线观看| 欧美日韩午夜在线| 欧美激情在线一区二区三区| 亚洲成a人在线观看| 国产很黄免费观看久久| 欧美日韩欧美一区二区| 日本一区二区三级电影在线观看| 一区二区高清免费观看影视大全| 国内成人免费视频| 欧美午夜精品一区二区蜜桃| 久久精品一区蜜桃臀影院| 亚洲国产成人av| 成人黄色a**站在线观看| 日韩一级大片在线观看| 亚洲国产一区在线观看| 成人在线视频一区二区| 日韩欧美中文一区二区| 亚洲一区二区三区四区不卡| 国产91色综合久久免费分享| 日韩欧美一级二级三级久久久| 一区二区视频在线看| 国产电影精品久久禁18| 日韩三级高清在线| 午夜精品久久久久久久蜜桃app| hitomi一区二区三区精品| 欧美精品一区二区高清在线观看 | 国产专区欧美精品| 欧美人伦禁忌dvd放荡欲情| 国产精品福利电影一区二区三区四区| 久久精品国产网站| 欧美精品一卡二卡| 亚洲一区二区三区中文字幕| 成人av动漫网站| 欧美韩日一区二区三区| 激情综合网天天干| 91精品国产美女浴室洗澡无遮挡| 亚洲精品videosex极品| 不卡视频免费播放| 中文字幕欧美日本乱码一线二线| 国产呦精品一区二区三区网站| 777欧美精品| 日韩国产在线一| 欧美日韩午夜精品| 亚洲午夜在线视频| 一本大道av伊人久久综合| 国产精品久久久久久久久图文区| 国产福利精品导航| 欧美国产一区视频在线观看| 国产黑丝在线一区二区三区| 久久久久国产成人精品亚洲午夜| 黄色小说综合网站| 日韩精品一区二区三区视频在线观看| 免费观看一级特黄欧美大片| 884aa四虎影成人精品一区| 天天操天天综合网| 在线播放91灌醉迷j高跟美女| 亚洲一区二区精品3399| 欧美网站一区二区| 亚洲一区二区在线视频| 欧美老肥妇做.爰bbww视频| 天天色 色综合| 日韩三级视频中文字幕| 精品亚洲成a人| 久久久www成人免费无遮挡大片| 国产aⅴ综合色| 亚洲啪啪综合av一区二区三区| 99re热这里只有精品免费视频| ●精品国产综合乱码久久久久| 91蝌蚪porny成人天涯| 亚洲综合视频网| 91精品国产综合久久久蜜臀粉嫩| 麻豆久久一区二区| 久久综合中文字幕| 成人国产精品免费网站| 亚洲女与黑人做爰| 欧美日韩精品一区二区在线播放| 日韩成人伦理电影在线观看| 精品国产精品网麻豆系列 | 欧美哺乳videos| 国产一区亚洲一区| 国产精品久久久久久久久免费桃花| 成人a级免费电影| 亚洲一区二区三区美女| 日韩一区二区视频| 国产寡妇亲子伦一区二区| 亚洲视频精选在线| 欧美日韩国产高清一区二区| 精品在线观看视频| 中文字幕一区二| 欧美日韩高清不卡| 国产呦精品一区二区三区网站| 国产精品久久久久久久久快鸭| 欧美天堂亚洲电影院在线播放| 美女视频黄久久| 国产精品每日更新在线播放网址| 91国偷自产一区二区开放时间 | 成人网在线免费视频| 亚洲韩国一区二区三区| 精品免费视频.| 色综合久久久久综合99| 精品一区二区三区香蕉蜜桃| 中文字幕在线一区免费| 欧美精品三级在线观看| 风间由美一区二区三区在线观看| 亚洲夂夂婷婷色拍ww47| 久久综合久久综合久久综合| 在线看日本不卡| 国产一区二区三区在线观看免费 | 成人免费一区二区三区视频 | 久久人人超碰精品| 欧美三级视频在线播放| 成人免费精品视频| 日本成人在线视频网站| 亚洲免费观看在线观看| 精品区一区二区| 欧美性三三影院| 成人性色生活片| 精品亚洲成av人在线观看| 亚洲国产日产av| 欧美激情在线看| 91精品麻豆日日躁夜夜躁| 91视视频在线观看入口直接观看www| 奇米四色…亚洲| 亚洲国产精品久久久男人的天堂 | 亚洲成人免费在线观看| 国产日韩欧美综合一区| 日韩欧美在线观看一区二区三区| 色综合久久88色综合天天6| 国产a级毛片一区| 精品一区二区三区久久| 午夜视频一区二区三区| 亚洲色图.com| 国产精品免费久久| 精品国产第一区二区三区观看体验| 欧美伦理视频网站| 在线亚洲免费视频| 91亚洲精华国产精华精华液| 国产乱码精品一品二品| 精品综合久久久久久8888| 日韩精品一级中文字幕精品视频免费观看 | 最新国产成人在线观看| 国产亚洲1区2区3区| 久久网站最新地址| 日韩欧美自拍偷拍| 日韩一级二级三级| 777欧美精品| 91精品国产综合久久久蜜臀粉嫩| 欧美日韩国产经典色站一区二区三区| 91国偷自产一区二区开放时间 | 成人国产精品免费观看视频| 国产不卡视频在线播放| 国产精品一二三四五| 国产精品一卡二卡在线观看|