void PriorityIn(LinkedList <ListEntry> list, ICCUpdatable target, int priority, bool paused) { var listElement = new ListEntry { Target = target, Priority = priority, Paused = paused, MarkedForDeletion = false }; if (list.First == null) { list.AddFirst(listElement); } else { bool added = false; for (LinkedListNode <ListEntry> node = list.First; node != null; node = node.Next) { if (priority < node.Value.Priority) { list.AddBefore(node, listElement); added = true; break; } } if (!added) { list.AddLast(listElement); } } // update hash entry for quick access var hashElement = new HashUpdateEntry { Target = target, List = list, Entry = listElement }; hashForUpdates.Add(target, hashElement); }
void AppendIn(LinkedList <ListEntry> list, ICCUpdatable target, bool paused) { var listElement = new ListEntry { Target = target, Paused = paused, MarkedForDeletion = false }; list.AddLast(listElement); // update hash entry for quicker access var hashElement = new HashUpdateEntry { Target = target, List = list, Entry = listElement }; hashForUpdates.Add(target, hashElement); }
private void AppendIn(LinkedList<ListEntry> list, ICCSelectorProtocol target, bool paused) { var listElement = new ListEntry { Target = target, Paused = paused, MarkedForDeletion = false }; list.AddLast(listElement); // update hash entry for quicker access var hashElement = new HashUpdateEntry { Target = target, List = list, Entry = listElement }; m_pHashForUpdates.Add(target, hashElement); }
private void PriorityIn(LinkedList<ListEntry> list, ICCSelectorProtocol target, int priority, bool paused) { var listElement = new ListEntry { Target = target, Priority = priority, Paused = paused, MarkedForDeletion = false }; if (list.First == null) { list.AddFirst(listElement); } else { bool added = false; for (LinkedListNode<ListEntry> node = list.First; node != null; node = node.Next) { if (priority < node.Value.Priority) { list.AddBefore(node, listElement); added = true; break; } } if (!added) { list.AddLast(listElement); } } // update hash entry for quick access var hashElement = new HashUpdateEntry { Target = target, List = list, Entry = listElement }; m_pHashForUpdates.Add(target, hashElement); }