Ejemplo n.º 1
0
 public void RemoveBuildUnit(PriorityQueueNode <AssetBuildUnit> node)
 {
     lock (queueLock)
     {
         queue.Remove(node);
     }
 }
Ejemplo n.º 2
0
 internal void Unschedule(PriorityQueueNode <SchedulerEntry> schedulerEntry)
 {
     lock (ScheduledEntries)
     {
         if (schedulerEntry.Index != -1)
         {
             ScheduledEntries.Remove(schedulerEntry);
         }
     }
 }
Ejemplo n.º 3
0
        public void TestRemoval()
        {
            var priorityQueue = new PriorityNodeQueue<int>();

            List<PriorityQueueNode<int>> nodes = new List<PriorityQueueNode<int>>();
            for (int i = 0; i < 1000; ++i)
            {
                nodes.Add(priorityQueue.Enqueue(i));
            }

            priorityQueue.Remove(nodes[3]);
            priorityQueue.Remove(nodes[0]);
            priorityQueue.Remove(nodes[500]);
            priorityQueue.Remove(nodes[251]);
            priorityQueue.Remove(nodes[999]);

            Assert.That(priorityQueue.Count, Is.EqualTo(1000 - 5));

            CheckPriorityQueue(priorityQueue);
        }
Ejemplo n.º 4
0
        public void TestRemoval()
        {
            var priorityQueue = new PriorityNodeQueue <int>();

            List <PriorityQueueNode <int> > nodes = new List <PriorityQueueNode <int> >();

            for (int i = 0; i < 1000; ++i)
            {
                nodes.Add(priorityQueue.Enqueue(i));
            }

            priorityQueue.Remove(nodes[3]);
            priorityQueue.Remove(nodes[0]);
            priorityQueue.Remove(nodes[500]);
            priorityQueue.Remove(nodes[251]);
            priorityQueue.Remove(nodes[999]);

            Assert.Equal(1000 - 5, priorityQueue.Count);

            CheckPriorityQueue(priorityQueue);
        }