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

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

?? deque.cs

?? C#寫的類似于STL的集合類,首先是C#編寫,可以用于.net變程.
?? CS
?? 第 1 頁 / 共 3 頁
字號(hào):
                    d += length;

                int c = move;
                while (c > 0) {
                    int chunk = c;
                    if (length - d < chunk)
                        chunk = length - d;
                    if (length - s < chunk)
                        chunk = length - s;
                    Array.Copy(buffer, s, buffer, d, chunk);
                    c -= chunk;
                    if ((d += chunk) >= length)
                        d -= length;
                    if ((s += chunk) >= length)
                        s -= length;
                }

                // At this point, s == end.
                for (c = 0; c < count; ++c) {
                    if (--s < 0)
                        s += length;
                    buffer[s] = default(T);
                }
                end = s;
            }
        }

        /// <summary>
        /// Increase the amount of buffer space. When calling this method, the Deque
        /// must not be empty. If start and end are equal, that indicates a completely
        /// full Deque.
        /// </summary>
        private void IncreaseBuffer()
        {
            int count = Count;
            int length = buffer.Length;

            T[] newBuffer = new T[length * 2];
            if (start >= end) {
                Array.Copy(buffer, start, newBuffer, 0, length - start);
                Array.Copy(buffer, 0, newBuffer, length - start, end);
                end = end + length - start;
                start = 0;
            }
            else {
                Array.Copy(buffer, start, newBuffer, 0, end - start);
                end = end - start;
                start = 0;
            }

            buffer = newBuffer;
        }

        /// <summary>
        /// Adds an item to the front of the Deque. The indices of all existing items
        /// in the Deque are increased by 1. This method is 
        /// equivalent to <c>Insert(0, item)</c> but is a little more
        /// efficient.
        /// </summary>
        /// <remarks>Adding an item to the front of the Deque takes
        /// a small constant amount of time, regardless of how many items are in the Deque.</remarks>
        /// <param name="item">The item to add.</param>
        public void AddToFront(T item)
        {
            StopEnumerations();

            if (buffer == null) {
                // The buffer hasn't been created yet.
                CreateInitialBuffer(item);
                return;
            }

            if (--start < 0)
                start += buffer.Length;
            buffer[start] = item;
            if (start == end)
                IncreaseBuffer();
        }

        /// <summary>
        /// Adds a collection of items to the front of the Deque. The indices of all existing items
        /// in the Deque are increased by the number of items inserted. The first item in the added collection becomes the
        /// first item in the Deque. 
        /// </summary>
        /// <remarks>This method takes time O(M), where M is the number of items in the 
        /// <paramref name="collection"/>.</remarks>
        /// <param name="collection">The collection of items to add.</param>
        public void AddManyToFront(IEnumerable<T> collection)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");

            InsertRange(0, collection);
        }

        /// <summary>
        /// Adds an item to the back of the Deque. The indices of all existing items
        /// in the Deque are unchanged. This method is 
        /// equivalent to <c>Insert(Count, item)</c> but is a little more
        /// efficient.
        /// </summary>
        /// <remarks>Adding an item to the back of the Deque takes
        /// a small constant amount of time, regardless of how many items are in the Deque.</remarks>
        /// <param name="item">The item to add.</param>
        public void AddToBack(T item)
        {
            StopEnumerations();

            if (buffer == null) {
                // The buffer hasn't been created yet.
                CreateInitialBuffer(item);
                return;
            }

            buffer[end] = item;
            if (++end >= buffer.Length)
                end -= buffer.Length;
            if (start == end)
                IncreaseBuffer();
        }

        /// <summary>
        /// Adds an item to the back of the Deque. The indices of all existing items
        /// in the Deque are unchanged. This method is 
        /// equivalent to <c>AddToBack(item)</c>.
        /// </summary>
        /// <remarks>Adding an item to the back of the Deque takes
        /// a small constant amount of time, regardless of how many items are in the Deque.</remarks>
        /// <param name="item">The item to add.</param>
        public sealed override void Add(T item)
        {
            AddToBack(item);
        }


        /// <summary>
        /// Adds a collection of items to the back of the Deque. The indices of all existing items
        /// in the Deque are unchanged. The last item in the added collection becomes the
        /// last item in the Deque.
        /// </summary>
        /// <remarks>This method takes time O(M), where M is the number of items in the 
        /// <paramref name="collection"/>.</remarks>
        /// <param name="collection">The collection of item to add.</param>
        public void AddManyToBack(IEnumerable<T> collection)
        {
            if (collection == null)
                throw new ArgumentNullException("collection");

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

        /// <summary>
        /// Removes an item from the front of the Deque. The indices of all existing items
        /// in the Deque are decreased by 1. This method is 
        /// equivalent to <c>RemoveAt(0)</c> but is a little more
        /// efficient.
        /// </summary>
        /// <remarks>Removing an item from the front of the Deque takes
        /// a small constant amount of time, regardless of how many items are in the Deque.</remarks>
        /// <returns>The item that was removed.</returns>
        /// <exception cref="InvalidOperationException">The Deque is empty.</exception>
        public T RemoveFromFront()
        {
            if (start == end)
                throw new InvalidOperationException(Strings.CollectionIsEmpty);

            StopEnumerations();

            T item = buffer[start];
            buffer[start] = default(T);
            if (++start >= buffer.Length)
                start -= buffer.Length;
            return item;
        }

        /// <summary>
        /// Removes an item from the back of the Deque. The indices of all existing items
        /// in the Deque are unchanged. This method is 
        /// equivalent to <c>RemoveAt(Count-1)</c> but is a little more
        /// efficient.
        /// </summary>
        /// <remarks>Removing an item from the back of the Deque takes
        /// a small constant amount of time, regardless of how many items are in the Deque.</remarks>
        /// <exception cref="InvalidOperationException">The Deque is empty.</exception>
        public T RemoveFromBack()
        {
            if (start == end)
                throw new InvalidOperationException(Strings.CollectionIsEmpty);

            StopEnumerations();

            if (--end < 0)
                end += buffer.Length;
            T item = buffer[end];
            buffer[end] = default(T);
            return item;
        }

        /// <summary>
        /// Retreives the item currently at the front of the Deque. The Deque is 
        /// unchanged. This method is 
        /// equivalent to <c>deque[0]</c> (except that a different exception is thrown).
        /// </summary>
        /// <remarks>Retreiving the item at the front of the Deque takes
        /// a small constant amount of time, regardless of how many items are in the Deque.</remarks>
        /// <returns>The item at the front of the Deque.</returns>
        /// <exception cref="InvalidOperationException">The Deque is empty.</exception>
        public T GetAtFront()
        {
            if (start == end)
                throw new InvalidOperationException(Strings.CollectionIsEmpty);

            return buffer[start];
        }

        /// <summary>
        /// Retreives the item currently at the back of the Deque. The Deque is 
        /// unchanged. This method is 
        /// equivalent to <c>deque[deque.Count - 1]</c> (except that a different exception is thrown).
        /// </summary>
        /// <remarks>Retreiving the item at the back of the Deque takes
        /// a small constant amount of time, regardless of how many items are in the Deque.</remarks>
        /// <returns>The item at the back of the Deque.</returns>
        /// <exception cref="InvalidOperationException">The Deque is empty.</exception>
        public T GetAtBack()
        {
            if (start == end)
                throw new InvalidOperationException(Strings.CollectionIsEmpty);

            if (end == 0)
                return buffer[buffer.Length - 1];
            else
                return buffer[end - 1];
        }

        /// <summary>
        /// Creates a new Deque that is a copy of this one.
        /// </summary>
        /// <remarks>Copying a Deque takes O(N) time, where N is the number of items in this Deque..</remarks>
        /// <returns>A copy of the current deque.</returns>
        public Deque<T> Clone()
        {
            return new Deque<T>(this);
        }

        /// <summary>
        /// Creates a new Deque that is a copy of this one.
        /// </summary>
        /// <remarks>Copying a Deque takes O(N) time, where N is the number of items in this Deque..</remarks>
        /// <returns>A copy of the current deque.</returns>
        object ICloneable.Clone()
        {
            return this.Clone();
        }

        /// <summary>
        /// Makes a deep clone of this Deque. A new Deque 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 Deque takes time O(N), where N is the number of items in the Deque.</para></remarks>
        /// <returns>The cloned Deque.</returns>
        /// <exception cref="InvalidOperationException">T is a reference type that does not implement ICloneable.</exception>
        public Deque<T> CloneContents()
        {
            bool itemIsValueType;
            if (!Util.IsCloneableType(typeof(T), out itemIsValueType))
                throw new InvalidOperationException(string.Format(Strings.TypeNotCloneable, typeof(T).FullName));

            Deque<T> clone = new Deque<T>();

            // 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.AddToBack(itemClone);
            }

            return clone;
        }

#if DEBUG
        /// <summary>
        /// Print out the internal state of the Deque for debugging.
        /// </summary>
        internal void Print()
        {
            Console.WriteLine("length={0}  start={1}  end={2}", buffer.Length, start, end);
            for (int i = 0; i < buffer.Length; ++i) {
                if (i == start)
                    Console.Write("start-> ");
                else
                    Console.Write("        ");
                if (i == end)
                    Console.Write("end-> ");
                else
                    Console.Write("      ");
                Console.WriteLine("{0,4} {1}", i, buffer[i]);
            }
            Console.WriteLine();
        }
#endif // DEBUG
    }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区美女| 久久精品欧美日韩精品 | 国产精品女主播在线观看| 欧美挠脚心视频网站| 91香蕉视频mp4| 日本不卡的三区四区五区| 中文字幕一区二区三区在线观看 | 国产精品热久久久久夜色精品三区| 色综合天天天天做夜夜夜夜做| 国产精品久久久久三级| 欧美不卡激情三级在线观看| 91啪在线观看| 国产成人在线视频免费播放| 免费欧美日韩国产三级电影| 成人精品国产一区二区4080| 亚洲福利视频一区二区| 国产精品黄色在线观看| 国产日产欧美一区二区视频| 久久久久高清精品| 国产精品三级av| 国产精品国产a级| 国产精品激情偷乱一区二区∴| 中文字幕在线不卡视频| 综合自拍亚洲综合图不卡区| 综合久久综合久久| 午夜精品久久久久久久| 日本欧美肥老太交大片| 国产九九视频一区二区三区| 高清视频一区二区| 精品视频一区二区不卡| 日韩一区二区三区在线视频| 久久九九久久九九| 亚洲另类中文字| 免费黄网站欧美| 岛国一区二区在线观看| 欧美日韩中文一区| 久久久电影一区二区三区| 国产欧美日韩在线看| 一区二区三区中文字幕精品精品 | aaa欧美色吧激情视频| 555www色欧美视频| 日本一二三不卡| 麻豆精品在线播放| 91精品福利视频| 国产午夜精品久久| 日韩不卡一区二区| 91性感美女视频| 精品久久久三级丝袜| 亚洲第一狼人社区| av在线播放一区二区三区| 精品国产髙清在线看国产毛片| 亚洲综合丝袜美腿| 成人激情免费视频| 精品国精品自拍自在线| 日本不卡在线视频| 欧美日韩色综合| 成人教育av在线| 日本一区二区三区四区| 激情都市一区二区| 欧美成人一区二区三区片免费| 亚洲在线成人精品| 成人av在线资源网| 国产精品成人在线观看| 成人av资源下载| 亚洲日本成人在线观看| 菠萝蜜视频在线观看一区| 国产精品三级电影| 91豆麻精品91久久久久久| 亚洲一区二区三区自拍| 色狠狠色狠狠综合| 三级欧美在线一区| 日韩欧美国产一区二区在线播放| 日韩福利视频网| 精品久久久久久久久久久久包黑料 | 天堂在线亚洲视频| 日韩一区二区电影在线| 经典三级一区二区| 久久久www成人免费无遮挡大片| 国产一区二区精品久久91| 国产午夜精品久久久久久久| 91视视频在线观看入口直接观看www | 久久疯狂做爰流白浆xx| 欧美一二三区在线| 大陆成人av片| 亚洲成人免费av| 欧美激情一区二区在线| 91黄色免费观看| 精品综合久久久久久8888| 国产精品水嫩水嫩| 欧美日韩精品三区| 国产成人av影院| 首页国产欧美久久| 中文字幕精品一区| 欧美高清你懂得| av在线这里只有精品| 日本欧美在线观看| 亚洲自拍偷拍网站| 欧美国产在线观看| 精品三级在线观看| 欧美日韩综合在线免费观看| 成人白浆超碰人人人人| 精品影视av免费| 日本va欧美va精品| 午夜精品久久久| 亚洲另类春色国产| 日本一区二区三区在线不卡| 精品日韩在线一区| 日韩欧美专区在线| 欧美乱妇一区二区三区不卡视频| 白白色 亚洲乱淫| 岛国一区二区在线观看| 成人永久免费视频| 69成人精品免费视频| 色偷偷88欧美精品久久久| 国产黄色精品网站| 国产一区二区三区在线观看免费| 日韩**一区毛片| 天天影视网天天综合色在线播放| 亚洲综合一二三区| 午夜精品国产更新| 另类小说色综合网站| 日本中文在线一区| 捆绑紧缚一区二区三区视频| 麻豆精品新av中文字幕| 国产一区二区三区视频在线播放| 精品制服美女丁香| 懂色av中文字幕一区二区三区| 成人在线一区二区三区| 色呦呦网站一区| 欧洲一区二区三区在线| 欧美精品在线观看播放| 久久青草欧美一区二区三区| 国产亚洲成av人在线观看导航 | 91精品欧美综合在线观看最新 | 精品欧美一区二区在线观看 | 亚洲第一福利视频在线| 久久国产乱子精品免费女| 国产精品亚洲一区二区三区在线| 不卡一二三区首页| 欧美图片一区二区三区| 国产丝袜美腿一区二区三区| 日韩美女精品在线| 久久成人麻豆午夜电影| 97超碰欧美中文字幕| 日韩欧美一二三区| 亚洲欧美国产毛片在线| 国产自产2019最新不卡| 在线观看欧美日本| 国产日韩av一区| 激情久久五月天| 538在线一区二区精品国产| 亚洲人吸女人奶水| 国产精品一区二区在线看| 亚洲欧洲精品一区二区三区不卡| 日韩电影在线免费观看| 欧美亚洲综合久久| 亚洲精品写真福利| 国产精品一区在线观看乱码| 欧美日韩一区久久| 亚洲一区视频在线| 成人涩涩免费视频| 欧美一区二区三区人| 国产欧美综合在线| 国产一区二区三区国产| 欧美一区二区三区视频免费播放| 欧美一区二区女人| 日本色综合中文字幕| 91黄色免费网站| 国产精品欧美一区喷水| 国产成人日日夜夜| 日韩电影在线观看电影| 欧美三级一区二区| 日本强好片久久久久久aaa| 欧美日韩精品一区二区三区| 一区二区三区中文字幕| 91视频在线观看免费| 国产精品第五页| 一本色道亚洲精品aⅴ| 亚洲视频在线一区观看| 成人精品免费看| 久久亚洲综合av| 国产精品一区二区久激情瑜伽| 欧美大片顶级少妇| 国产麻豆视频一区二区| 日本一区二区三区dvd视频在线| 国产成人免费网站| 日韩精品一区二区三区蜜臀| 久久99精品视频| 日韩一区二区免费在线电影 | 欧美韩国日本综合| 不卡一区在线观看| 伊人性伊人情综合网| 欧美一区二区三区在线观看视频| 麻豆精品新av中文字幕| 国产人成一区二区三区影院| 91视视频在线观看入口直接观看www| 亚洲影视资源网| 69av一区二区三区| 99视频精品全部免费在线| 亚洲在线视频免费观看|