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

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

?? multidictionarybase.cs

?? C#寫的類似于STL的集合類,首先是C#編寫,可以用于.net變程.
?? CS
?? 第 1 頁 / 共 3 頁
字號:
?//******************************
// 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;
using System.Collections.Generic;
using System.Diagnostics;

namespace Wintellect.PowerCollections
{
    /// <summary>
    /// MultiDictionaryBase is a base class that can be used to more easily implement a class
    /// that associates multiple values to a single key. The class implements the generic
    /// IDictionary&lt;TKey, ICollection&lt;TValue&gt;&gt; interface.
    /// </summary>
    /// <remarks>
    /// <para>To use MultiDictionaryBase as a base class, the derived class must override
    /// Count, Clear, Add, Remove(TKey), Remove(TKey,TValue), Contains(TKey,TValue), 
    /// EnumerateKeys, and TryEnumerateValuesForKey. </para>
    /// <para>It may wish consider overriding CountValues, CountAllValues, ContainsKey,
    /// and EqualValues, but these are not required.
    /// </para>
    /// </remarks>
    /// <typeparam name="TKey">The key type of the dictionary.</typeparam>
    /// <typeparam name="TValue">The value type of the dictionary.</typeparam>
    [Serializable]
    [DebuggerDisplay("{DebuggerDisplayString()}")]
    public abstract class MultiDictionaryBase<TKey, TValue> : CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>,
                                                                                               IDictionary<TKey, ICollection<TValue>>
    {
        /// <summary>
        /// Creates a new MultiDictionaryBase. 
        /// </summary>
        protected MultiDictionaryBase()
        {
        }

        /// <summary>
        /// Clears the dictionary. This method must be overridden in the derived class.
        /// </summary>
        public abstract override void Clear();

        /// <summary>
        /// Gets the number of keys in the dictionary. This property must be overridden
        /// in the derived class.
        /// </summary>
        public abstract override int Count
        {
            get;
        }

        /// <summary>
        /// Enumerate all the keys in the dictionary. This method must be overridden by a derived
        /// class.
        /// </summary>
        /// <returns>An IEnumerator&lt;TKey&gt; that enumerates all of the keys in the collection that
        /// have at least one value associated with them.</returns>
        protected abstract IEnumerator<TKey> EnumerateKeys();

        /// <summary>
        /// Enumerate all of the values associated with a given key. This method must be overridden
        /// by the derived class. If the key exists and has values associated with it, an enumerator for those
        /// values is returned throught <paramref name="values"/>. If the key does not exist, false is returned.
        /// </summary>
        /// <param name="key">The key to get values for.</param>
        /// <param name="values">If true is returned, this parameter receives an enumerators that
        /// enumerates the values associated with that key.</param>
        /// <returns>True if the key exists and has values associated with it. False otherwise.</returns>
        protected abstract bool TryEnumerateValuesForKey(TKey key, out IEnumerator<TValue> values);

        /// <summary>
        /// Adds a key-value pair to the collection. The value part of the pair must be a collection
        /// of values to associate with the key. If values are already associated with the given
        /// key, the new values are added to the ones associated with that key.
        /// </summary>
        /// <param name="item">A KeyValuePair contains the Key and Value collection to add.</param>
        public override void Add(KeyValuePair<TKey, ICollection<TValue>> item)
        {
            this.AddMany(item.Key, item.Value);
        }

        /// <summary>
        /// Implements IDictionary&lt;TKey, IEnumerable&lt;TValue&gt;&gt;.Add. If the 
        /// key is already present, and ArgumentException is thrown. Otherwise, a
        /// new key is added, and new values are associated with that key.
        /// </summary>
        /// <param name="key">Key to add.</param>
        /// <param name="values">Values to associate with that key.</param>
        /// <exception cref="ArgumentException">The key is already present in the dictionary.</exception>
        void IDictionary<TKey, ICollection<TValue>>.Add(TKey key, ICollection<TValue> values)
        {
            if (ContainsKey(key)) {
                throw new ArgumentException(Strings.KeyAlreadyPresent, "key");
            }
            else {
                AddMany(key, values);
            }
        }

        /// <summary>
        /// <para>Adds new values to be associated with a key. If duplicate values are permitted, this
        /// method always adds new key-value pairs to the dictionary.</para>
        /// <para>If duplicate values are not permitted, and <paramref name="key"/> already has a value
        /// equal to one of <paramref name="values"/> associated with it, then that value is replaced,
        /// and the number of values associate with <paramref name="key"/> is unchanged.</para>
        /// </summary>
        /// <param name="key">The key to associate with.</param>
        /// <param name="values">A collection of values to associate with <paramref name="key"/>.</param>
        public virtual void AddMany(TKey key, IEnumerable<TValue> values)
        {
            foreach (TValue value in values)
                Add(key, value);
        }

        /// <summary>
        /// Adds a new key-value pair to the dictionary.  This method must be overridden in the derived class.
        /// </summary>
        /// <param name="key">Key to add.</param>
        /// <param name="value">Value to associated with the key.</param>
        /// <exception cref="ArgumentException">key is already present in the dictionary</exception>
        public abstract void Add(TKey key, TValue value);

        /// <summary>
        /// Removes a key from the dictionary. This method must be overridden in the derived class.
        /// </summary>
        /// <param name="key">Key to remove from the dictionary.</param>
        /// <returns>True if the key was found, false otherwise.</returns>
        public abstract bool Remove(TKey key);

        /// <summary>
        /// Removes a key-value pair from the dictionary. This method must be overridden in the derived class.
        /// </summary>
        /// <param name="key">Key to remove from the dictionary.</param>
        /// <param name="value">Associated value to remove from the dictionary.</param>
        /// <returns>True if the key-value pair was found, false otherwise.</returns>
        public abstract bool Remove(TKey key, TValue value);

        /// <summary>
        /// Removes a set of values from a given key. If all values associated with a key are
        /// removed, then the key is removed also.
        /// </summary>
        /// <param name="pair">A KeyValuePair contains a key and a set of values to remove from that key.</param>
        /// <returns>True if at least one values was found and removed.</returns>
        public override bool Remove(KeyValuePair<TKey,ICollection<TValue>> pair)
        {
 	        return RemoveMany(pair.Key, pair.Value) > 0;  
        }

        /// <summary>
        /// Removes a collection of values from the values associated with a key. If the
        /// last value is removed from a key, the key is removed also.
        /// </summary>
        /// <param name="key">A key to remove values from.</param>
        /// <param name="values">A collection of values to remove.</param>
        /// <returns>The number of values that were present and removed. </returns>
        public virtual int RemoveMany(TKey key, IEnumerable<TValue> values)
        {
            int countRemoved = 0;

            foreach (TValue val in values) {
                if (Remove(key, val))
                    ++countRemoved;
            }

            return countRemoved;
        }

        /// <summary>
        /// Remove all of the keys (and any associated values) in a collection
        /// of keys. If a key is not present in the dictionary, nothing happens.
        /// </summary>
        /// <param name="keyCollection">A collection of key values to remove.</param>
        /// <returns>The number of keys from the collection that were present and removed.</returns>
        public int RemoveMany(IEnumerable<TKey> keyCollection)
        {
            int count = 0;
            foreach (TKey key in keyCollection) {
                if (Remove(key))
                    ++count;
            }

            return count;
        }


        /// <summary>
        /// Determines if this dictionary contains a key equal to <paramref name="key"/>. If so, all the values
        /// associated with that key are returned through the values parameter. This method must be
        /// overridden by the derived class.
        /// </summary>
        /// <param name="key">The key to search for.</param>
        /// <param name="values">Returns all values associated with key, if true was returned.</param>
        /// <returns>True if the dictionary contains key. False if the dictionary does not contain key.</returns>
        bool IDictionary<TKey,ICollection<TValue>>.TryGetValue(TKey key, out ICollection<TValue> values)
        {
            if (ContainsKey(key)) {
                values = this[key];
                return true;
            }
            else {
                values = null;
                return false;
            }
        }

        /// <summary>
        /// Determines whether a given key is found in the dictionary.
        /// </summary>
        /// <remarks>The default implementation simply calls TryEnumerateValuesForKey.
        /// It may be appropriate to override this method to 
        /// provide a more efficient implementation.</remarks>
        /// <param name="key">Key to look for in the dictionary.</param>
        /// <returns>True if the key is present in the dictionary.</returns>
        public virtual bool ContainsKey(TKey key)
        {
            IEnumerator<TValue> values;
            return TryEnumerateValuesForKey(key, out values);
        }

        /// <summary>
        /// Determines if this dictionary contains a key-value pair equal to <paramref name="key"/> and 
        /// <paramref name="value"/>. The dictionary is not changed. This method must be overridden in the derived class.
        /// </summary>
        /// <param name="key">The key to search for.</param>
        /// <param name="value">The value to search for.</param>
        /// <returns>True if the dictionary has associated <paramref name="value"/> with <paramref name="key"/>.</returns>
        public abstract bool Contains(TKey key, TValue value);

        /// <summary>
        /// Determines if this dictionary contains the given key and all of the values associated with that key..
        /// </summary>
        /// <param name="pair">A key and collection of values to search for.</param>
        /// <returns>True if the dictionary has associated all of the values in <paramref name="pair"/>.Value with <paramref name="pair"/>.Key.</returns>
        public override bool Contains(KeyValuePair<TKey,ICollection<TValue>> pair)
        {
            foreach (TValue val in pair.Value) {
                if (! Contains(pair.Key, val))
                    return false;
            }

            return true;
        }

        // Cache the equality comparer after we get it the first time.
        private volatile IEqualityComparer<TValue> valueEqualityComparer;

        /// <summary>
        /// If the derived class does not use the default comparison for values, this
        /// methods should be overridden to compare two values for equality. This is
        /// used for the correct implementation of ICollection.Contains on the Values
        /// and KeyValuePairs collections.
        /// </summary>
        /// <param name="value1">First value to compare.</param>
        /// <param name="value2">Second value to compare.</param>
        /// <returns>True if the values are equal.</returns>
        protected virtual bool EqualValues(TValue value1, TValue value2)
        {
            if (valueEqualityComparer == null)
                valueEqualityComparer = EqualityComparer<TValue>.Default;
            return valueEqualityComparer.Equals(value1, value2);
        }

        /// <summary>
        /// Gets a count of the number of values associated with a key. The
        /// default implementation is slow; it enumerators all of the values
        /// (using TryEnumerateValuesForKey) to count them. A derived class
        /// may be able to supply a more efficient implementation.
        /// </summary>
        /// <param name="key">The key to count values for.</param>
        /// <returns>The number of values associated with <paramref name="key"/>.</returns>
        protected virtual int CountValues(TKey key)
        {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚欧色一区w666天堂| 亚洲激情图片qvod| 欧美电视剧免费全集观看| 欧美在线不卡视频| 在线观看视频一区二区欧美日韩| 99这里只有久久精品视频| www.亚洲精品| 欧美性大战久久久久久久蜜臀| 在线视频欧美区| 欧美精品高清视频| 日韩精品一区二| 国产精品青草综合久久久久99| 亚洲欧美在线aaa| 亚洲福利视频导航| 黄色精品一二区| 成人黄色电影在线 | 久久99久久99小草精品免视看| 日韩激情视频在线观看| 久久丁香综合五月国产三级网站| 国产乱一区二区| 一本色道亚洲精品aⅴ| 国产精品乱码人人做人人爱 | 色综合欧美在线视频区| 欧美日韩成人高清| 久久亚洲精华国产精华液 | 欧美一级精品大片| 中文字幕精品一区二区精品绿巨人| 欧美高清在线精品一区| 五月天中文字幕一区二区| 国产九九视频一区二区三区| 色老汉一区二区三区| 91精品国产黑色紧身裤美女| 国产亚洲自拍一区| 亚洲123区在线观看| 国产成人综合网站| 91精品一区二区三区久久久久久 | 91网址在线看| 久久久久久亚洲综合| 一区二区三区精品视频| 国产精品一线二线三线| 欧美日韩黄色一区二区| 国产欧美一区二区精品仙草咪| 性做久久久久久久久| av爱爱亚洲一区| 欧美精品一区视频| 日本不卡免费在线视频| 一本大道久久a久久综合婷婷| 欧美变态口味重另类| 亚洲一线二线三线视频| 成人精品视频一区二区三区尤物| 91精品国产91久久久久久最新毛片| 亚洲欧洲精品一区二区三区| 国产精品一二二区| 日韩精品在线看片z| 亚洲一区二区3| 91在线免费播放| 国产肉丝袜一区二区| 精品一区二区三区香蕉蜜桃| 666欧美在线视频| 亚洲一区二区在线观看视频| bt欧美亚洲午夜电影天堂| 国产亚洲精品中文字幕| 国产一区二三区| 久久久久久免费毛片精品| 久久精品国产99国产| 欧美一级片在线观看| 亚洲国产成人va在线观看天堂| 在线观看亚洲专区| 洋洋成人永久网站入口| 91看片淫黄大片一级| 亚洲免费伊人电影| 色吊一区二区三区| 亚洲一线二线三线久久久| 欧美专区日韩专区| 午夜精品aaa| 欧美一区二区日韩| 日本人妖一区二区| 精品日韩av一区二区| 国产一区二区三区精品视频| 久久久久久久久99精品| 成人精品gif动图一区| 国产精品国产自产拍高清av王其 | 精品国产乱码久久久久久1区2区| 秋霞电影一区二区| 欧美成人激情免费网| 国产精品一区二区久久精品爱涩| 国产亚洲精品7777| 菠萝蜜视频在线观看一区| 国产精品美女久久久久高潮| 在线区一区二视频| 奇米888四色在线精品| 久久久久99精品一区| 岛国精品在线播放| 亚洲综合视频网| 精品国产sm最大网站免费看| 国产成人亚洲精品青草天美| 亚洲欧美日韩国产综合| 欧美日韩aaaaa| 国产成人在线观看| 一区二区三区日韩欧美精品| 欧美一区二区三区喷汁尤物| 国产在线播精品第三| 日韩美女啊v在线免费观看| 欧美性受xxxx黑人xyx性爽| 久久av中文字幕片| 亚洲精品欧美激情| 精品少妇一区二区三区在线播放 | 久久99久国产精品黄毛片色诱| 国产欧美日韩亚州综合| 欧美日韩久久久| 久久99久久精品欧美| 悠悠色在线精品| 欧美成人video| 在线观看国产日韩| 国产成人精品免费视频网站| 亚洲综合激情另类小说区| 亚洲精品在线观看视频| 欧美中文字幕一二三区视频| 国产成人午夜电影网| 天天影视涩香欲综合网| 中文子幕无线码一区tr| 欧美精品v国产精品v日韩精品| 波多野结衣欧美| 国产在线精品一区二区三区不卡| 亚洲在线一区二区三区| 中文av一区特黄| 久久久国际精品| 日韩精品中文字幕一区| 欧美丝袜第三区| 91久久一区二区| 成人免费看片app下载| 精品午夜久久福利影院| 日日夜夜精品视频免费| 亚洲免费在线播放| 国产精品久久久久久久久动漫| 精品动漫一区二区三区在线观看| 欧美日韩在线精品一区二区三区激情| 国产999精品久久久久久绿帽| 蜜臀av在线播放一区二区三区| 亚洲午夜免费电影| 亚洲精品免费在线观看| 亚洲日本电影在线| 中文字幕精品在线不卡| 国产午夜精品一区二区| 国产亚洲一二三区| 久久精品在这里| 国产欧美日韩不卡| 欧美高清一级片在线观看| 国产亚洲女人久久久久毛片| 久久九九99视频| 国产精品视频线看| 国产精品久久久久久久久动漫| 国产精品久久久久三级| 欧美—级在线免费片| 国产精品久久久久一区| 亚洲精品一卡二卡| 一区二区三区不卡在线观看| 一区二区三区四区蜜桃| 午夜久久久影院| 婷婷综合另类小说色区| 亚欧色一区w666天堂| 久热成人在线视频| 成熟亚洲日本毛茸茸凸凹| 成人动漫一区二区在线| 在线观看免费亚洲| 777午夜精品免费视频| 欧美va亚洲va在线观看蝴蝶网| 精品国产制服丝袜高跟| 国产清纯美女被跳蛋高潮一区二区久久w| 久久久久久久久久久久久夜| 亚洲欧洲色图综合| 日韩国产欧美在线视频| 美女任你摸久久| av资源网一区| 欧美高清hd18日本| 久久蜜臀精品av| 亚洲综合男人的天堂| 亚洲欧美国产三级| 日韩成人精品视频| 国产乱码字幕精品高清av| 97精品久久久午夜一区二区三区| 欧美日韩中文字幕一区二区| 精品福利一区二区三区免费视频| 国产精品麻豆欧美日韩ww| 午夜视频在线观看一区| 国产精品自拍毛片| 欧美日韩国产综合一区二区三区| 久久久久久久性| 五月天久久比比资源色| jvid福利写真一区二区三区| 91精品国产综合久久久久久久| 国产嫩草影院久久久久| 午夜国产不卡在线观看视频| 成人涩涩免费视频| 日韩美女主播在线视频一区二区三区| 欧美国产国产综合| 久久99精品国产麻豆婷婷| 波多野结衣中文字幕一区 | 激情综合色综合久久综合| 色综合天天综合网天天看片|