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

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

?? cyclicbuffer.cs

?? 詳細講述了數據庫編程
?? CS
字號:
#region Copyright & License
//
// Copyright 2001-2005 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

using System;

using log4net.Core;

namespace log4net.Util
{
	/// <summary>
	/// A fixed size rolling buffer of logging events.
	/// </summary>
	/// <remarks>
	/// <para>
	/// An array backed fixed size leaky bucket.
	/// </para>
	/// </remarks>
	/// <author>Nicko Cadell</author>
	/// <author>Gert Driesen</author>
	public class CyclicBuffer
	{
		#region Public Instance Constructors

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="maxSize">The maximum number of logging events in the buffer.</param>
		/// <remarks>
		/// <para>
		/// Initializes a new instance of the <see cref="CyclicBuffer" /> class with 
		/// the specified maximum number of buffered logging events.
		/// </para>
		/// </remarks>
		/// <exception cref="ArgumentOutOfRangeException">The <paramref name="maxSize"/> argument is not a positive integer.</exception>
		public CyclicBuffer(int maxSize) 
		{
			if (maxSize < 1) 
			{
				throw SystemInfo.CreateArgumentOutOfRangeException("maxSize", (object)maxSize, "Parameter: maxSize, Value: [" + maxSize + "] out of range. Non zero positive integer required");
			}

			m_maxSize = maxSize;
			m_events = new LoggingEvent[maxSize];
			m_first = 0;
			m_last = 0;
			m_numElems = 0;
		}

		#endregion Public Instance Constructors

		#region Public Instance Methods
	
		/// <summary>
		/// Appends a <paramref name="loggingEvent"/> to the buffer.
		/// </summary>
		/// <param name="loggingEvent">The event to append to the buffer.</param>
		/// <returns>The event discarded from the buffer, if the buffer is full, otherwise <c>null</c>.</returns>
		/// <remarks>
		/// <para>
		/// Append an event to the buffer. If the buffer still contains free space then
		/// <c>null</c> is returned. If the buffer is full then an event will be dropped
		/// to make space for the new event, the event dropped is returned.
		/// </para>
		/// </remarks>
		public LoggingEvent Append(LoggingEvent loggingEvent)
		{	
			if (loggingEvent == null)
			{
				throw new ArgumentNullException("loggingEvent");
			}

			lock(this)
			{
				// save the discarded event
				LoggingEvent discardedLoggingEvent = m_events[m_last];

				// overwrite the last event position
				m_events[m_last] = loggingEvent;	
				if (++m_last == m_maxSize)
				{
					m_last = 0;
				}

				if (m_numElems < m_maxSize)
				{
					m_numElems++;
				}
				else if (++m_first == m_maxSize)
				{
					m_first = 0;
				}

				if (m_numElems < m_maxSize)
				{
					// Space remaining
					return null;
				}
				else
				{
					// Buffer is full and discarding an event
					return discardedLoggingEvent;
				}
			}
		}

		/// <summary>
		/// Get and remove the oldest event in the buffer.
		/// </summary>
		/// <returns>The oldest logging event in the buffer</returns>
		/// <remarks>
		/// <para>
		/// Gets the oldest (first) logging event in the buffer and removes it 
		/// from the buffer.
		/// </para>
		/// </remarks>
		public LoggingEvent PopOldest() 
		{
			lock(this)
			{
				LoggingEvent ret = null;
				if (m_numElems > 0) 
				{
					m_numElems--;
					ret = m_events[m_first];
					m_events[m_first] = null;
					if (++m_first == m_maxSize)
					{
						m_first = 0;
					}
				} 
				return ret;
			}
		}

		/// <summary>
		/// Pops all the logging events from the buffer into an array.
		/// </summary>
		/// <returns>An array of all the logging events in the buffer.</returns>
		/// <remarks>
		/// <para>
		/// Get all the events in the buffer and clear the buffer.
		/// </para>
		/// </remarks>
		public LoggingEvent[] PopAll()
		{
			lock(this)
			{
				LoggingEvent[] ret = new LoggingEvent[m_numElems];

				if (m_numElems > 0)
				{
					if (m_first < m_last)
					{
						Array.Copy(m_events, m_first, ret, 0, m_numElems);
					}
					else
					{
						Array.Copy(m_events, m_first, ret, 0, m_maxSize - m_first);
						Array.Copy(m_events, 0, ret, m_maxSize - m_first, m_last);
					}
				}

				Clear();

				return ret;
			}
		}

		/// <summary>
		/// Clear the buffer
		/// </summary>
		/// <remarks>
		/// <para>
		/// Clear the buffer of all events. The events in the buffer are lost.
		/// </para>
		/// </remarks>
		public void Clear()
		{
			lock(this)
			{
				// Set all the elements to null
				Array.Clear(m_events, 0, m_events.Length);

				m_first = 0;
				m_last = 0;
				m_numElems = 0;
			}
		}

#if RESIZABLE_CYCLIC_BUFFER
		/// <summary>
		/// Resizes the cyclic buffer to <paramref name="newSize"/>.
		/// </summary>
		/// <param name="newSize">The new size of the buffer.</param>
		/// <remarks>
		/// <para>
		/// Resize the cyclic buffer. Events in the buffer are copied into
		/// the newly sized buffer. If the buffer is shrunk and there are
		/// more events currently in the buffer than the new size of the
		/// buffer then the newest events will be dropped from the buffer.
		/// </para>
		/// </remarks>
		/// <exception cref="ArgumentOutOfRangeException">The <paramref name="newSize"/> argument is not a positive integer.</exception>
		public void Resize(int newSize) 
		{
			lock(this)
			{
				if (newSize < 0) 
				{
					throw log4net.Util.SystemInfo.CreateArgumentOutOfRangeException("newSize", (object)newSize, "Parameter: newSize, Value: [" + newSize + "] out of range. Non zero positive integer required");
				}
				if (newSize == m_numElems)
				{
					return; // nothing to do
				}
	
				LoggingEvent[] temp = new  LoggingEvent[newSize];

				int loopLen = (newSize < m_numElems) ? newSize : m_numElems;
	
				for(int i = 0; i < loopLen; i++) 
				{
					temp[i] = m_events[m_first];
					m_events[m_first] = null;

					if (++m_first == m_numElems) 
					{
						m_first = 0;
					}
				}

				m_events = temp;
				m_first = 0;
				m_numElems = loopLen;
				m_maxSize = newSize;

				if (loopLen == newSize) 
				{
					m_last = 0;
				} 
				else 
				{
					m_last = loopLen;
				}
			}
		}
#endif

		#endregion Public Instance Methods

		#region Public Instance Properties

		/// <summary>
		/// Gets the <paramref name="i"/>th oldest event currently in the buffer.
		/// </summary>
		/// <value>The <paramref name="i"/>th oldest event currently in the buffer.</value>
		/// <remarks>
		/// <para>
		/// If <paramref name="i"/> is outside the range 0 to the number of events
		/// currently in the buffer, then <c>null</c> is returned.
		/// </para>
		/// </remarks>
		public LoggingEvent this[int i] 
		{
			get
			{
				lock(this)
				{
					if (i < 0 || i >= m_numElems)
					{
						return null;
					}

					return m_events[(m_first + i) % m_maxSize];
				}
			}
		}

		/// <summary>
		/// Gets the maximum size of the buffer.
		/// </summary>
		/// <value>The maximum size of the buffer.</value>
		/// <remarks>
		/// <para>
		/// Gets the maximum size of the buffer
		/// </para>
		/// </remarks>
		public int MaxSize 
		{
			get 
			{ 
				lock(this)
				{
					return m_maxSize; 
				}
			}
#if RESIZABLE_CYCLIC_BUFFER
			set 
			{ 
				/// Setting the MaxSize will cause the buffer to resize.
				Resize(value); 
			}
#endif
		}

		/// <summary>
		/// Gets the number of logging events in the buffer.
		/// </summary>
		/// <value>The number of logging events in the buffer.</value>
		/// <remarks>
		/// <para>
		/// This number is guaranteed to be in the range 0 to <see cref="MaxSize"/>
		/// (inclusive).
		/// </para>
		/// </remarks>
		public int Length
		{
			get 
			{ 
				lock(this) 
				{ 
					return m_numElems; 
				}
			}									
		}

		#endregion Public Instance Properties

		#region Private Instance Fields

		private LoggingEvent[] m_events;
		private int m_first; 
		private int m_last; 
		private int m_numElems;
		private int m_maxSize;

		#endregion Private Instance Fields
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区美女在线| 色欲综合视频天天天| 欧美精品在线观看播放| 亚洲成人资源网| 在线播放一区二区三区| 水蜜桃久久夜色精品一区的特点| 色妞www精品视频| 亚洲免费观看在线观看| 欧美三级一区二区| 激情丁香综合五月| 国产激情视频一区二区在线观看| 美女国产一区二区三区| 欧美私人免费视频| 久久不见久久见免费视频7| 国产日产精品一区| 欧美视频一区二区三区| 精品亚洲国内自在自线福利| 国产免费观看久久| 在线成人av网站| 99久久国产免费看| 美女视频第一区二区三区免费观看网站| 日韩欧美国产高清| 欧美日韩一二三| 97se亚洲国产综合自在线不卡| 免费高清成人在线| 亚洲一线二线三线久久久| 久久久久久久网| 欧美不卡视频一区| 91精品国产91综合久久蜜臀| 欧洲一区在线观看| av在线这里只有精品| 丁香婷婷综合激情五月色| 韩国视频一区二区| 国产一区在线观看麻豆| 紧缚奴在线一区二区三区| 日韩国产欧美在线视频| 日韩精品亚洲一区| 首页国产欧美久久| 日本在线观看不卡视频| 五月婷婷激情综合| 日韩经典一区二区| 精品一区二区三区在线播放| 精品一区二区三区不卡| 国产一区欧美二区| 日本久久电影网| 欧美日韩国产系列| 2021中文字幕一区亚洲| 中文字幕 久热精品 视频在线| 久久久亚洲精品一区二区三区| 久久久亚洲欧洲日产国码αv| 国产精品不卡一区| 午夜精品免费在线| 成人免费毛片嘿嘿连载视频| 9i在线看片成人免费| 日韩欧美高清一区| 亚洲国产精品成人久久综合一区| 国产精品不卡一区二区三区| 日韩成人精品在线| va亚洲va日韩不卡在线观看| 欧美一级xxx| 亚洲精品国产精华液| 久久国产精品第一页| 91丝袜美女网| 久久久久国产精品麻豆ai换脸 | 风间由美性色一区二区三区| 色域天天综合网| 国产三级精品三级| 蜜臀av一区二区| 欧美日韩高清影院| 一区二区三国产精华液| 高清不卡一二三区| 国产亚洲欧美日韩在线一区| 日本亚洲天堂网| 日韩欧美在线不卡| 青娱乐精品视频| 欧美一区二区三区男人的天堂| 一个色在线综合| 欧美日精品一区视频| 亚洲宅男天堂在线观看无病毒| 91亚洲午夜精品久久久久久| 国产精品久久久久久久久动漫| 成人精品视频网站| 1区2区3区精品视频| 在线观看av一区| 日本伊人色综合网| 精品剧情v国产在线观看在线| 久久99精品久久久| 国产欧美精品一区| 日本韩国一区二区| 伦理电影国产精品| 中文字幕亚洲一区二区va在线| 99精品国产视频| 日韩电影在线免费观看| 久久蜜臀中文字幕| 欧美中文字幕一区| 国内精品第一页| 一区二区在线看| 国产麻豆视频一区| 欧美男同性恋视频网站| 亚洲最新视频在线观看| 精品国产99国产精品| 不卡欧美aaaaa| 日本最新不卡在线| 一区在线中文字幕| 精品播放一区二区| 欧美福利电影网| 色国产综合视频| 成人h动漫精品一区二区| 免费黄网站欧美| 日韩va亚洲va欧美va久久| 亚洲日本成人在线观看| 国产欧美一区二区三区网站| 欧美一区午夜视频在线观看| av激情成人网| 91捆绑美女网站| 99国产精品久久久久久久久久| 国产一区二区三区蝌蚪| 免费看黄色91| 国产最新精品精品你懂的| 美女网站视频久久| 美国十次了思思久久精品导航| 亚洲成人1区2区| 丝袜亚洲另类丝袜在线| 视频一区视频二区中文字幕| 亚洲精品一卡二卡| 五月天激情综合| 麻豆国产精品视频| 国内一区二区视频| www.亚洲色图.com| 91国偷自产一区二区三区成为亚洲经典| 成人免费va视频| 在线观看91视频| 欧美成人精品福利| 国产精品国产自产拍高清av王其| 亚洲欧美在线观看| 午夜精品成人在线| 国产成人福利片| 一本大道久久a久久综合婷婷| 欧美色图激情小说| 精品av久久707| 天天综合日日夜夜精品| 精品亚洲国产成人av制服丝袜| 99久久777色| 久久精品夜夜夜夜久久| 亚洲高清三级视频| 色综合久久久网| 国产精品免费丝袜| 成人永久免费视频| 不卡的av电影在线观看| 日韩精品一区二区在线| 亚洲视频一区二区在线| 精品综合久久久久久8888| 欧美三级一区二区| 亚洲欧美日韩国产中文在线| 国产成人自拍网| 久久尤物电影视频在线观看| 日日噜噜夜夜狠狠视频欧美人| av在线不卡网| 亚洲伦在线观看| 91在线精品秘密一区二区| 久久精品一级爱片| 波多野结衣中文字幕一区二区三区| 欧美刺激脚交jootjob| 天堂久久久久va久久久久| 欧美在线视频全部完| 亚洲国产精品影院| 欧美美女bb生活片| 美女任你摸久久| 亚洲精品一区二区三区99| 日韩电影免费在线| 久久久久国产精品人| 懂色av中文字幕一区二区三区| 欧美国产成人精品| 欧美日本高清视频在线观看| 午夜视频在线观看一区二区三区| 日本韩国欧美一区| 欧美a级一区二区| 国产精品视频观看| 欧美人牲a欧美精品| 麻豆精品视频在线观看免费| 国产婷婷色一区二区三区四区 | 久久久久久一二三区| 99国产精品久久久久| 免费在线观看视频一区| 国产精品视频第一区| 91精品国产91综合久久蜜臀| 成人午夜电影久久影院| 爽好多水快深点欧美视频| 国产日韩欧美综合一区| 欧美三级资源在线| 国产精品一区2区| 午夜免费久久看| 中文字幕中文乱码欧美一区二区 | 69久久夜色精品国产69蝌蚪网| 国产成人免费视频网站| 免费成人小视频| 午夜精品视频在线观看| 亚洲国产一区二区三区青草影视 | 国产精品视频免费| 久久亚洲精华国产精华液|