Changeset 16779 for trunk/HeuristicLab.ExtLibs/HeuristicLab.SimSharp/3.1.1/SimSharp-3.1.1/Collections
- Timestamp:
- 04/12/19 13:45:11 (6 years ago)
- Location:
- trunk/HeuristicLab.ExtLibs/HeuristicLab.SimSharp/3.1.1
- Files:
-
- 5 added
- 1 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.ExtLibs/HeuristicLab.SimSharp/3.1.1/SimSharp-3.1.1/Collections/EventQueue.cs
r15972 r16779 6 6 /// <summary> 7 7 /// An implementation of a min-Priority Queue using a heap. Has O(1) .Contains()! 8 /// See https:// bitbucket.org/BlueRaja/high-speed-priority-queue-for-c/wiki/Getting%20Started for more information8 /// See https://github.com/BlueRaja/High-Speed-Priority-Queue-for-C-Sharp/wiki/Getting-Started for more information 9 9 /// </summary> 10 10 /// <remarks> … … 48 48 /// Removes every node from the queue. O(n) (So, don't do this often!) 49 49 /// </summary> 50 #if AGGRESSIVE_INLINING 51 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 52 #endif 50 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 53 51 public void Clear() { 54 52 Array.Clear(_nodes, 1, _numNodes); … … 59 57 /// Returns (in O(1)!) whether the given node is in the queue. O(1) 60 58 /// </summary> 61 #if AGGRESSIVE_INLINING 62 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 63 #endif 59 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 64 60 public bool Contains(EventQueueNode node) { 65 61 return (_nodes[node.QueueIndex] == node); … … 69 65 /// Enqueue a node - .Priority must be set beforehand! O(log n) 70 66 /// </summary> 71 #if AGGRESSIVE_INLINING 72 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 73 #endif 67 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 74 68 public EventQueueNode Enqueue(DateTime primaryPriority, Event @event, int secondaryPriority = 0) { 75 69 var node = new EventQueueNode { … … 84 78 return node; 85 79 } 86 87 #if AGGRESSIVE_INLINING 88 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 89 #endif 80 81 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 90 82 private void Swap(EventQueueNode node1, EventQueueNode node2) { 91 83 //Swap the nodes … … 115 107 } 116 108 117 #if AGGRESSIVE_INLINING 118 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 119 #endif 109 110 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 120 111 private void CascadeDown(EventQueueNode node) { 121 112 //aka Heapify-down … … 170 161 /// Note that calling HasHigherPriority(node, node) (ie. both arguments the same node) will return false 171 162 /// </summary> 172 #if AGGRESSIVE_INLINING 173 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 174 #endif 163 164 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 175 165 private bool HasHigherPriority(EventQueueNode higher, EventQueueNode lower) { 176 166 return (higher.PrimaryPriority < lower.PrimaryPriority || … … 204 194 /// O(log n) 205 195 /// </summary> 206 #if AGGRESSIVE_INLINING 207 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 208 #endif 196 197 [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 209 198 public void UpdatePriority(EventQueueNode node, DateTime primaryPriority, int secondaryPriority) { 210 199 node.PrimaryPriority = primaryPriority;
Note: See TracChangeset
for help on using the changeset viewer.