private static IEnumerable<Type> getTypes(Type sourceType) { Queue<Type> pending = new Queue<Type>(); HashSet<Type> visited = new HashSet<Type>(); pending.Enqueue(sourceType); while (pending.Count != 0) { Type type = pending.Dequeue(); visited.Add(type); yield return type; if (type.BaseType != null) { if (!visited.Contains(type.BaseType)) { pending.Enqueue(type.BaseType); } } foreach (Type interfaceType in type.GetInterfaces()) { if (!visited.Contains(interfaceType)) { pending.Enqueue(interfaceType); } } } }
public WebConnectionGroup (ServicePoint sPoint, string name) { this.sPoint = sPoint; this.name = name; connections = new LinkedList<ConnectionState> (); queue = new Queue<HttpWebRequest> (); }
static void Run (Queue q) { MergeContext context = GetDefaultContext (); while (q.Count > 0) { string token = (string) q.Dequeue (); if (token.Length < 2) Usage (); if (token [0] == '-' && token [1] == '-') { if (token.Length < 3) Usage (); switch (token [2]) { case 'v': Version (); break; case 'a': About (); break; default: Usage (); break; } } if (token [0] == '-' || token [0] == '/') { token = token.Substring (1); if (token == "o" || token == "out") context.OutputPath = (string) q.Dequeue (); else if (token == "e" || token == "exe") context.OutputIsExecutable = true; else if (token == "d" || token == "dll") context.OutputIsExecutable = false; else if (token == "L") context.NativeLibraries.LibrariesSearchPaths.Add ((string) q.Dequeue ()); else if (token == "l") context.NativeLibraries.Libraries.Add ((string) q.Dequeue ()); else Usage (); } else { context.Assemblies.Add (token); while (q.Count > 0) context.Assemblies.Add ((string) q.Dequeue ()); } } if (context.Assemblies.Count < 2) Error ("At least two assemblies needed"); if (context.OutputPath == "") Error ("Please set output filename"); context.NativeLibraries.Libraries.Add ("c"); context.NativeLibraries.LibrariesSearchPaths.Add ("/lib"); context.NativeLibraries.Initialize (); context.Link (); }
public Listener(IPEndPoint ipep) { m_Accepted = new Queue<Socket>(); m_AcceptedSyncRoot = ((ICollection)m_Accepted).SyncRoot; m_Listener = Bind(ipep); if (m_Listener == null) { return; } DisplayListener(); #if NewAsyncSockets m_EventArgs = new SocketAsyncEventArgs(); m_EventArgs.Completed += new EventHandler<SocketAsyncEventArgs>( Accept_Completion ); Accept_Start(); #else m_OnAccept = OnAccept; try { IAsyncResult res = m_Listener.BeginAccept(m_OnAccept, m_Listener); } catch (SocketException ex) { NetState.TraceException(ex); } catch (ObjectDisposedException) { } #endif }
public void Build(object parentObject, Queue<SqlCommand> insertCommands, Queue<SqlCommand> insertLastCommands) { this.m_InsertSubclassOnly = false; Type objectType = parentObject.GetType(); this.ProcessObjectForInsert(parentObject, objectType, insertCommands, insertLastCommands); this.HandlePersistentChildCollections(parentObject, objectType, insertCommands, insertLastCommands); }
public IEnumerator Start() { pool = new InventoryPool<InventoryUIItemWrapper>(wrapperPrefab, 8); queue = new Queue<ItemHolder>(8); destroyTimer = new WaitForSeconds(slideAnimation.length - 0.025f); offsetTimer = new WaitForSeconds(offsetTimerSeconds); foreach (var inv in InventoryManager.GetLootToCollections()) { inv.OnAddedItem += (items, amount, cameFromCollection) => { if (cameFromCollection == false) { queue.Enqueue(new ItemHolder() { item = items.FirstOrDefault(), stackSize = amount}); } }; } while (true) { if (queue.Count > 0) { ShowItem(queue.Peek().item, queue.Peek().stackSize); queue.Dequeue(); // Remove it } yield return offsetTimer; } }
public ReversePolishNotationEvaluator() { output = new Queue(); ops = new Stack(); postfixExpression = string.Empty; }
/// <summary> /// Call to reset from a previous run of the spider /// </summary> public void reset() { m_already = new Hashtable(); //?从本地导入索引文件 m_workload = new Queue(); m_quit = false; }
public WalksOnFurni(RoomItem item, Room room) { Item = item; Room = room; ToWork = new Queue(); Items = new List<RoomItem>(); }
private static void Main() { string inputSentence = SampleSentence; string splitPattern = @"(\s+|\s*\,\s*|\s*\-\s*|\s*\!|\s*\.)"; string[] elements = Regex.Split(inputSentence, splitPattern); Stack words = new Stack(); Queue separators = new Queue(); StringBuilder result = new StringBuilder(); foreach (var element in elements) { if (Regex.IsMatch(element, splitPattern)) { separators.Enqueue(element); } else if (Regex.IsMatch(element, @"\S")) { words.Push(element); } } while (words.Count > 0) { result.Append(words.Pop()); result.Append(separators.Dequeue()); } Console.WriteLine(result); }
public static void Show(string sMessage) { // If this is the first time a page has called this method then if (!m_executingPages.Contains(HttpContext.Current.Handler)) { // Attempt to cast HttpHandler as a Page. Page executingPage = HttpContext.Current.Handler as Page; if (executingPage != null) { // Create a Queue to hold one or more messages. Queue messageQueue = new Queue(); // Add our message to the Queue messageQueue.Enqueue(sMessage); // Add our message queue to the hash table. Use our page reference // (IHttpHandler) as the key. m_executingPages.Add(HttpContext.Current.Handler, messageQueue); // Wire up Unload event so that we can inject some JavaScript for the alerts. executingPage.Unload += new EventHandler(ExecutingPage_Unload); } } else { // If were here then the method has allready been called from the executing Page. // We have allready created a message queue and stored a reference to it in our hastable. Queue queue = (Queue)m_executingPages[HttpContext.Current.Handler]; // Add our message to the Queue queue.Enqueue(sMessage); } }
public Notifier () { _enabled = true; _queue = new Queue<NotificationMessage> (); _sync = ((ICollection) _queue).SyncRoot; _waitHandle = new ManualResetEvent (false); ThreadPool.QueueUserWorkItem ( state => { while (_enabled || Count > 0) { var msg = dequeue (); if (msg != null) { #if UBUNTU var nf = new Notification (msg.Summary, msg.Body, msg.Icon); nf.AddHint ("append", "allowed"); nf.Show (); #else Console.WriteLine (msg); #endif } else { Thread.Sleep (500); } } _waitHandle.Set (); }); }
private static IEnumerable<Type> GetTypesOrderedByGeneration(Type[] sourceTypes) { var queue = new Queue<Type>(sourceTypes); var sortedList = new LinkedList<Type>(); while (queue.Count > 0) { var currentType = queue.Dequeue(); // Search through the list and make sure this type is added before any type deriving from it. var node = sortedList.First; while (true) { if (node == null) { sortedList.AddLast(currentType); break; } if (currentType.IsAssignableFrom(node.Value)) { sortedList.AddBefore(node, currentType); break; } node = node.Next; } } return sortedList; }
private static void FillQueue(int firstX, int firstY, byte currColor, byte destColor) { Queue<Tuple<int, int>> q = new Queue<Tuple<int, int>>(); q.Enqueue(Tuple.Create(firstX, firstY)); var maxX = _data.GetLength(0); var maxY = _data.GetLength(1); while (q.Count > 0) { var point = q.Dequeue(); var x = point.Item1; var y = point.Item2; if (_data[x, y] == destColor) continue; if (_data[x, y] != currColor) continue; _data[x, y] = destColor; if (x + 1 < maxX) q.Enqueue(Tuple.Create(x + 1, y)); if (x - 1 >= 0) q.Enqueue(Tuple.Create(x - 1, y)); if (y + 1 < maxY) q.Enqueue(Tuple.Create(x, y + 1)); if (y - 1 >= 0) q.Enqueue(Tuple.Create(x, y - 1)); Display(_data); } }
public BulletPool() { if(this.Capacity.Equals(null)) this.Capacity = 32; this.queue = new Queue(Capacity); }
public Player(TcpClient client, string ip, byte id) { try { this.username = "******"; this.plyClient = client; this.x = 0; this.y = 0; this.z = 0; this.rotx = 0; this.roty = 0; this.prefix = ""; this.id = id; this.ip = ip; this.world = null; this.outQueue = new Queue<Packet>(); this.blockQueue = new Queue<Packet>(); this.IOThread = new Thread(PlayerIO); this.outputWriter = new BinaryWriter(client.GetStream()); this.inputReader = new BinaryReader(client.GetStream()); this.IOThread.IsBackground = true; this.IOThread.Start(); } catch { } }
public PriorityQueue() { for(int i = 0; i < _queues.Length; ++i) { _queues[i] = new Queue(); } }
public bool StartSniffing(LivePcapDevice deviceToSniff) { try { device = deviceToSniff; // Open the device for capturing int readTimeoutMilliseconds = 1000; //device.StopCaptureTimeout = new TimeSpan(0, 1, 0); device.Open(DeviceMode.Promiscuous, readTimeoutMilliseconds); device.SetFilter(GetFilterExpression()); packetQueue = new Queue(); sniffingThread = new Thread(new ThreadStart(SnifferLoop)); sniffingThread.Name = "Sniffing Thread"; sniffingThread.IsBackground = true; sniffingThread.Start(); decodingThread = new Thread(new ThreadStart(DecoderLoop)); decodingThread.Name = "Decoding Thread"; decodingThread.IsBackground = true; decodingThread.Start(); Log("Sniffing started"); } catch (Exception e) { Log(e.ToString()); return false; } return true; }
private static void DrawSnakeElement(Queue<Position> inputQueue) { foreach (Position curentElementPosition in inputQueue) { DrawSingleElement(curentElementPosition, "*"); } }
public Main( RemoteHooking.IContext InContext, string serverName ) { mySendClientQueue = new Queue<Packet>(); mySendClientLock = new object(); mySendServerQueue = new Queue<Packet>(); mySendServerLock = new object(); myRecvFilter = new bool[256]; mySendFilter = new bool[256]; myRecvDelegate = new dSendRecv( ReceiveHook ); mySendDelegate = new dSendRecv( SendHook ); myPID = RemoteHooking.GetCurrentProcessId(); myThreadID = RemoteHooking.GetCurrentThreadId(); myDateStamp = GetDateStamp(); myServerSendBuffer = Marshal.AllocHGlobal( 65536 ); myClientSendBuffer = Marshal.AllocHGlobal( 65536 ); myServerBufferAddress = BitConverter.GetBytes( myServerSendBuffer.ToInt32() ); myClientBufferAddress = BitConverter.GetBytes( myClientSendBuffer.ToInt32() ); myClientInstance = new ClientInstance( serverName, true ); myClientInstance.SendCommand( Command.ClientID, myPID ); myClientInstance.SendPacketEvent += new dSendPacket( myClientInstance_sendPacketEvent ); myClientInstance.PingEvent += new dPing( myClientInstance_pingEvent ); myClientInstance.AddRecvFilterEvent += new dAddRecvFilter( myClientInstance_addRecvFilterEvent ); myClientInstance.AddSendFilterEvent += new dAddSendFilter( myClientInstance_addSendFilterEvent ); myClientInstance.RemoveRecvFilterEvent += new dRemoveRecvFilter( myClientInstance_removeRecvFilterEvent ); myClientInstance.RemoveSendFilterEvent += new dRemoveSendFilter( myClientInstance_removeSendFilterEvent ); myClientInstance.ClearRecvFilterEvent += new dClearRecvFilter( myClientInstance_clearRecvFilterEvent ); myClientInstance.ClearSendFilterEvent += new dClearSendFilter( myClientInstance_clearSendFilterEvent ); }
//конструктор public NextFigure(INextFigure figure) { this.figure = figure; queue = new Queue<int>(); rand = new Random(); queue.Enqueue(rand.Next(0,7)); }
public WebConnectionGroup (ServicePoint sPoint, string name) { this.sPoint = sPoint; this.name = name; connections = new ArrayList (1); queue = new Queue (); }
public RProc(bool withStdErr, string filename, string args) { this.OutputQueue = Queue.Synchronized(new Queue()); this.processStartInfo = new ProcessStartInfo(filename, args); this.processStartInfo.CreateNoWindow = true; this.processStartInfo.UseShellExecute = false; this.processStartInfo.RedirectStandardInput = true; this.processStartInfo.RedirectStandardOutput = true; if (withStdErr) { this.processStartInfo.RedirectStandardError = true; } this.process = new Process(); this.process.StartInfo = this.processStartInfo; try // exception isn't thrown to the caller otherwise { this.process.Start(); } finally { } this.thread_out = new Thread(new ThreadStart(this.OutLoop)); thread_out.Start(); if (withStdErr) { this.thread_err = new Thread(new ThreadStart(this.StderrLoop)); thread_err.Start(); } }
internal Profiler() { _requestsToProfile = 10; _outputMode = TraceMode.SortByTime; _localOnly = true; _mostRecent = false; _requests = new Queue(_requestsToProfile); }
// #region 事件处理相关... // private DrawObjEventHandler _BeforDrawObject; // public event DrawObjEventHandler BeforDrawObject { // add { // _BeforDrawObject += value; // } // remove { // _BeforDrawObject -= value; // } // // } // private void FireBeforDrawObject(DrawObjEventArgs e) { // if (mBeforDrawObject != null) { // // 调用相应的委托代理 // mBeforDrawObject(this, e); // } // } // #endregion 事件处理相关... public DrawReport(object pDs, DIYReport.ReportModel.RptReport pDataReport) { _RptData = pDs; DIYReport.UserDIY.DesignEnviroment.DataSource = pDs; _DataReport = pDataReport; _Rows = DIYReport.GroupAndSort.GroupDataProcess.SortData(pDs, pDataReport); _RptInfo = new ReportDrawInfo(pDataReport); _FooterExpress = DIYReport.Express.ExpressValueList.GetFooterExpress(pDataReport); _BottomExpress = DIYReport.Express.ExpressValueList.GetBottomExpress(pDataReport); _DocSize = _DataReport.PaperSize; _DocMargin = _DataReport.Margins; //初始化页页数 DIYReport.Express.ExSpecial._Page = 1; DIYReport.Express.ExSpecial._PageCount = 1; _DrawDetailInfo = new DrawDetailInfo(pDataReport); _GroupFoots = new Stack(); _GroupHeads = new Queue(); float mergeHeight = _DataReport.SectionList.GetExceptDetailHeight(); int rHeight = _DataReport.IsLandscape? _DocSize.Width : _DocSize.Height; REAL_DETAIL_HEIGHT = rHeight - Convert.ToInt32(mergeHeight) - _DocMargin.Top - _DocMargin.Bottom; int rWidth = _DataReport.IsLandscape? _DocSize.Height : _DocSize.Width; REAL_PAGE_WIDTH = rWidth - _DocMargin.Left - _DocMargin.Right; DIYReport.Express.ExSpecial._RowOrderNO = 0; }
public static void Main(string[] args) { System.Collections.Queue kö = new System.Collections.Queue(10); { kö.Enqueue(1); kö.Enqueue(2); kö.Enqueue(3); kö.Enqueue(15); kö.Enqueue(null); kö.Enqueue(20); kö.Enqueue("test string"); kö.Enqueue(25); Console.WriteLine($"Totalt antal element = {kö.Count}"); //Räknar antal element i kön Console.WriteLine(kö.Peek()); //Kollar elementen i kön enligt ordning kö.Dequeue(); Console.WriteLine(kö.Peek()); kö.Dequeue(); Console.WriteLine(kö.Peek()); kö.Dequeue(); kö.Dequeue(); Console.WriteLine(kö.Peek()); kö.Dequeue(); kö.Dequeue(); Console.WriteLine(kö.Peek()); kö.Dequeue(); Console.WriteLine(kö.Peek()); Console.WriteLine($"Antal element efter = {kö.Count}"); // Visar att elementen tagits bort kö.Clear(); } }
/* ------------------------------------- Private Methods ----------------------------------- */ /// <summary> Removes the first element. Returns null if no elements in queue. /// Always called with add_mutex locked (we don't have to lock add_mutex ourselves) /// </summary> protected object removeInternal(System.Collections.Queue queue) { object obj = null; lock (mutex) { int count = queue.Count; if (count > 0) { obj = queue.Dequeue(); } else { return(null); } size--; if (size < 0) { size = 0; } if (peekInternal() == endMarker) { closed = true; } } return(obj); }
private void queueButton_Click(object sender, EventArgs e) { Queue fila = new Queue(); //Adicionando itens fila.Enqueue("Gabriela"); fila.Enqueue("Rafael"); fila.Enqueue("Thiago"); //Exibindo os itens da coleção foreach (string elemento in fila) { listBox1.Items.Add(elemento); } listBox1.Items.Add("--------------"); //Exibindo o item primeiro da fila listBox1.Items.Add("primeiro da fila"); listBox1.Items.Add(fila.Peek()); listBox1.Items.Add("--------------"); //Retirando um elemento da fila (primeiro da fila) fila.Dequeue(); //Exibindo o item primeiro da fila listBox1.Items.Add("primeiro da fila"); listBox1.Items.Add(fila.Peek()); }
public override void execute3(RunTimeValueBase thisObj,FunctionDefine functionDefine,SLOT returnSlot,SourceToken token,StackFrame stackframe,out bool success) { System.Collections.Queue queue = (System.Collections.Queue)((LinkObj <object>)((ASBinCode.rtData.rtObjectBase)thisObj).value).value; try { queue.TrimToSize(); returnSlot.setValue(ASBinCode.rtData.rtUndefined.undefined); success = true; } //catch (KeyNotFoundException) //{ // success = false; // stackframe.throwAneException(token, arraylist.ToString() + "没有链接到脚本"); //} catch (ArgumentException a) { success = false; stackframe.throwAneException(token,a.Message); } catch (IndexOutOfRangeException i) { success = false; stackframe.throwAneException(token,i.Message); } }
/// <summary> /// Default constructor initializes worker thread and Queue. /// </summary> private Queue() { Q = new System.Collections.Queue(); WorkerThread = new Thread(new ThreadStart(ThreadMain)); WorkerThread.Start(); Queues.Add(this); }
static void Main(string[] args) { //ArrayList ArrayList arrayList = new ArrayList(); arrayList.Add("First item"); arrayList.Add(5); arrayList.Add('c'); foreach (var item in arrayList) { Console.WriteLine("Element of arrayList: {0}", item); } //HashTable Hashtable hashtable = new Hashtable(); hashtable.Add(0, "Zero item"); hashtable[1] = "First item"; hashtable["2"] = "Second item"; hashtable[Guid.NewGuid()] = "Third item"; ICollection keys = hashtable.Keys; foreach (var key in keys) { Console.WriteLine("Key: {0}, Value: {1}", key, hashtable[key]); } //SortedList SortedList sl = new SortedList(); sl.Add("007", "Ritesh Saikia"); sl.Add("001", "Zara Ali"); sl.Add("002", "Abida Rehman"); sl.Add("003", "Joe Holzner"); sl.Add("004", "Mausam Benazir Nur"); sl.Add("006", "M. Amlan"); sl.Add("005", "M. Arif"); ICollection slValues = sl.Values; foreach (var s in slValues) { Console.WriteLine("SortedList value: {0}", s); } //Queue is FIFO: First in First out Queue que = new Queue(); que.Enqueue("Student_1"); que.Enqueue(5); que.Enqueue("Student_2"); que.Enqueue("Student_3"); Console.WriteLine(que.Dequeue().ToString()); Console.WriteLine(que.Dequeue().ToString()); // Stack is FILO: First in Last out Stack StackPop = new Stack(); StackPop.Push("Student_1"); StackPop.Push("Student_2"); StackPop.Push("Student_3"); Console.WriteLine(StackPop.Pop().ToString()); Console.WriteLine(StackPop.Pop().ToString()); Console.ReadLine(); }
/// <summary> /// returns true if path exists from startVertex to endVertex /// </summary> private bool breadthFirstSearch(object startVertex, object endVertex) { var queue = new Queue(); var vertexQueue = new Queue(); bool found = false; graph.clearMarks(); queue.Enqueue(startVertex); do { object vertex = queue.Dequeue(); if (vertex == endVertex) found = true; else { if (!graph.isMarked(vertex)) { graph.markVertex(vertex); vertexQueue = graph.getToVertices(vertex); while (vertexQueue.Count > 0) { object item = vertexQueue.Dequeue(); if (!graph.isMarked(item)) queue.Enqueue(item); } } } } while (queue.Count > 0 & !found); return found; }
public void BFS(VNode v) { /*使用队列来实现广度优先搜索 */ Queue<VNode> q = new Queue<VNode>(); v.Visited = true; q.Enqueue(v); Console.WriteLine("Visit:{0}", v.Data); while (q.Count > 0) { var vnode = q.Dequeue(); var enode = vnode.FirstEdge; while (null != enode) { if (!enode.Adj.Visited) { enode.Adj.Visited = true; Console.WriteLine("Visit:{0}", enode.Adj.Data); q.Enqueue(enode.Adj); } enode = enode.Next; } } }
public IList BreadthFirstSearch(BatteryStation s) { UnmarkAll(); IList l = new ArrayList(); Queue<BatteryStation> q = new Queue<BatteryStation>(); q.Enqueue(s); l.Add(s); s.Mark = true; while (q.Count > 0) { BatteryStation n = q.Dequeue(); BatteryStation c = null; while ((c = GetNextUnMarked(GetAdjacencies(n))) != null) { c.Mark = true; q.Enqueue(c); l.Add(c); } } return l; }
public void CLeanEmail() { var coda = new Queue<MailRequest>(); var obs = new MailObserver<MailRequest>(coda); obs.Client.CleanEmail(); Assert.IsTrue(true); }
public static void ClearNoTouchZero(Dictionary <int, System.Collections.Queue> dic, Dictionary <int, PoolFlag_t> dicTouchZero) { if (dic != null) { if (dic.Count > 1) { foreach (KeyValuePair <int, System.Collections.Queue> data in dic) { PoolFlag_t t_TouchZero = new PoolFlag_t(); t_TouchZero.Clear(); dicTouchZero.TryGetValue(data.Key, out t_TouchZero); int cnt = 0; int delcnt = t_TouchZero.CanDel(); if (delcnt > 0) { System.Collections.Queue q = data.Value; cnt = q.Count; if (cnt > 1) { //清三分之一 for (int i = 0; i < delcnt; i++) { System.Object obj = q.Dequeue(); obj = null; } } } t_TouchZero.InPool -= delcnt; t_TouchZero.total -= delcnt; dicTouchZero[data.Key] = t_TouchZero; } } } }
public static void Main() { const int multiplier = 2; const int firstAddend = 1; const int secondAddend = 2; int sequenceLength = 50; int currentNumber = int.Parse(Console.ReadLine()); var sequence = new Queue<int>(); var tempQueue = new Queue<int>(); sequence.Enqueue(currentNumber); tempQueue.Enqueue(currentNumber); while (sequence.Count < sequenceLength) { currentNumber = tempQueue.Dequeue(); sequence.Enqueue(currentNumber + firstAddend); sequence.Enqueue(multiplier * currentNumber + firstAddend); sequence.Enqueue(currentNumber + secondAddend); tempQueue.Enqueue(currentNumber + firstAddend); tempQueue.Enqueue(multiplier * currentNumber + firstAddend); tempQueue.Enqueue(currentNumber + secondAddend); } while (sequenceLength > 0) { Console.Write(sequence.Dequeue() + " "); sequenceLength--; } }
public void TestQueue() { System.Collections.Queue target = new System.Collections.Queue(); CollectionUtils.AddAll(target, new object[] { 4, "5", '6' }); Assert.AreEqual(4, target.Dequeue()); Assert.AreEqual("5", target.Dequeue()); Assert.AreEqual('6', target.Dequeue()); }
/// <summary> /// Constructor for Dispatch Mananger /// </summary> /// <param name="dispatcher"></param> /// <param name="queue"></param> public DispatchManager(Dispatcher dispatcher) { this._isRunning = false; this._isKilled = false; this._dispatcher = dispatcher; //Console.Write(dispatcher); this._queue = Queue.Synchronized(new Queue()); }
/// <summary> /// Construct a new reporter. /// </summary> public ProgressReporter(CommandLine.IOHandler handler = null) { textQueue = System.Collections.Queue.Synchronized(new System.Collections.Queue()); maxProgressLines = 0; linesReported = 0; LineHandler += CommandLineIOHandler; Complete = null; }
/// <summary> /// Construct a new reporter. /// </summary> /// <param name="logger">Logger to log command output.</param> public ProgressReporter(Google.Logger logger) { textQueue = System.Collections.Queue.Synchronized(new System.Collections.Queue()); maxProgressLines = 0; linesReported = 0; LineHandler += CommandLineIOHandler; this.logger = logger; Complete = null; }
private void Initialize() { this.m_StackOld = new InterlockedStack(); this.m_StackNew = new InterlockedStack(); this.m_QueuedRequests = new System.Collections.Queue(); this.m_WaitHandles = new WaitHandle[] { new System.Net.Semaphore(0, 0x100000), new ManualResetEvent(false), new Mutex() }; this.m_ErrorTimer = null; this.m_ObjectList = new ArrayList(); this.m_State = State.Running; }
public void runQueue() { // Create a queue // Using Queue class System.Collections.Queue my_queue = new System.Collections.Queue(); // Adding elements in Queue // Using Enqueue() method my_queue.Enqueue("GFG"); my_queue.Enqueue("Geeks"); my_queue.Enqueue("GeeksforGeeks"); my_queue.Enqueue("geeks"); my_queue.Enqueue("Geeks123"); Console.WriteLine("Total elements present in my_queue: {0}", my_queue.Count); // Checking if the element is // present in the Queue or not if (my_queue.Contains("GeeksforGeeks") == true) { Console.WriteLine("Element available...!!"); } else { Console.WriteLine("Element not available...!!"); } // Obtain the topmost element of my_queue // Using Dequeue method Console.WriteLine("Topmost element of my_queue" + " is: {0}", my_queue.Dequeue()); Console.WriteLine("Total elements present in my_queue: {0}", my_queue.Count); // Obtain the topmost element of my_queue // Using Peek method Console.WriteLine("Topmost element of my_queue is: {0}", my_queue.Peek()); // After Dequeue method Console.WriteLine("Total elements present in my_queue: {0}", my_queue.Count); // Remove all the elements from the queue my_queue.Clear(); // After Clear method Console.WriteLine("Total elements present in my_queue: {0}", my_queue.Count); Console.ReadLine(); }
static public int Clear(IntPtr l) { try { System.Collections.Queue self = (System.Collections.Queue)checkSelf(l); self.Clear(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_SyncRoot(IntPtr l) { try { System.Collections.Queue self = (System.Collections.Queue)checkSelf(l); pushValue(l, true); pushValue(l, self.SyncRoot); return(2); } catch (Exception e) { return(error(l, e)); } }
public static void Main(string[] args) { var q1 = new System.Collections.Queue(); q1.Enqueue(1); q1.Enqueue(2); q1.Enqueue(3); Console.WriteLine(q1.Dequeue() + ""); Console.WriteLine(q1.Dequeue() + ""); Console.WriteLine(q1.Dequeue()); }
private void Init() { this.BufferReadLength = this.MainBuffer.Length; this.CountLock = new object(); this.PendingBytesSent = 0; this.SendLock = new object(); this.SendQueue = new System.Collections.Queue(); this.ReceiveCB = new AsyncCallback(this.HandleReceive); this.SendCB = new AsyncCallback(this.HandleSend); this.ConnectCB = new AsyncCallback(this.HandleConnect); this.rEP = new IPEndPoint(0L, 0); }
static public int ctor_s(IntPtr l) { try { System.Collections.Queue o; o = new System.Collections.Queue(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int ToArray(IntPtr l) { try { System.Collections.Queue self = (System.Collections.Queue)checkSelf(l); var ret = self.ToArray(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
//save selections for use in mouseup private void gridControl1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { gridControl1.PointToRowCol(new Point(e.X, e.Y), out this.mouseDownRow, out this.mouseDownCol); if (mouseDownCol == colBase && gridControl1.CurrentCell.ColIndex != colBase) { //save the old selections so we can reset them later oldSelections = new Queue(); foreach (GridRangeInfo r in gridControl1.Selections.Ranges) { oldSelections.Enqueue(r); } } }
public FTPAsynchronousConnection() : base() { this.threadPool = new ArrayList(); this.sendFileTransfersQueue = new System.Collections.Queue(); this.getFileTransfersQueue = new System.Collections.Queue(); this.deleteFileQueue = new System.Collections.Queue(); this.setCurrentDirectoryQueue = new System.Collections.Queue(); this.makeDirQueue = new System.Collections.Queue(); this.removeDirQueue = new System.Collections.Queue(); this.timer = new System.Timers.Timer(100); this.timer.Elapsed += new System.Timers.ElapsedEventHandler(ManageThreads); this.timer.Start(); }
static void Main(string[] args) { System.Collections.Queue q = new System.Collections.Queue(); q.Enqueue(1); q.Enqueue(2); q.Enqueue(3); q.Enqueue(4); ReverseOfQueue(q); Console.WriteLine("Queue elements are:"); foreach (int i in q) { Console.Write(i + " "); } }
static int TrimToSize(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); System.Collections.Queue obj = (System.Collections.Queue)ToLua.CheckObject(L, 1, typeof(System.Collections.Queue)); obj.TrimToSize(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int Enqueue(IntPtr l) { try { System.Collections.Queue self = (System.Collections.Queue)checkSelf(l); System.Object a1; checkType(l, 2, out a1); self.Enqueue(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private void PruneAbortedRequests() { lock (this.m_ConnectionList) { System.Collections.Queue queue = new System.Collections.Queue(); foreach (HttpWebRequest request in this.AuthenticationRequestQueue) { if (!request.Aborted) { queue.Enqueue(request); } } this.AuthenticationRequestQueue = queue; } }
static int GetEnumerator(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); System.Collections.Queue obj = (System.Collections.Queue)ToLua.CheckObject(L, 1, typeof(System.Collections.Queue)); System.Collections.IEnumerator o = obj.GetEnumerator(); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ToArray(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); System.Collections.Queue obj = (System.Collections.Queue)ToLua.CheckObject(L, 1, typeof(System.Collections.Queue)); object[] o = obj.ToArray(); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int Contains(IntPtr l) { try { System.Collections.Queue self = (System.Collections.Queue)checkSelf(l); System.Object a1; checkType(l, 2, out a1); var ret = self.Contains(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static int Synchronized(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); System.Collections.Queue arg0 = (System.Collections.Queue)ToLua.CheckObject(L, 1, typeof(System.Collections.Queue)); System.Collections.Queue o = System.Collections.Queue.Synchronized(arg0); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int ctor__ICollection_s(IntPtr l) { try { System.Collections.Queue o; System.Collections.ICollection a1; checkType(l, 1, out a1); o = new System.Collections.Queue(a1); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }