Ejemplo n.º 1
0
 public bool Remove(BucketQueueNode <T> node)
 {
     if (node.Queue != this)
     {
         return(false);
     }
     if (node.Prev != null)
     {
         node.Prev.Next = node.Next;
     }
     else
     {
         buckets[node.BucketIndex].First = node.Next;
     }
     if (node.Next != null)
     {
         node.Next.Prev = node.Prev;
     }
     else
     {
         buckets[node.BucketIndex].Last = node.Prev;
     }
     node.Queue       = null;
     node.BucketIndex = -1;
     node.Prev        = node.Next = null;
     count--;
     return(true);
 }
Ejemplo n.º 2
0
        public BucketQueueNode <T> Enqueue(int bucketIndex, T value)
        {
            var node = new BucketQueueNode <T>(value);

            Enqueue(bucketIndex, node);
            return(node);
        }
Ejemplo n.º 3
0
        public void Enqueue(int bucketIndex, BucketQueueNode <T> node)
        {
            if (node.Queue != null)
            {
                throw new ArgumentException(nameof(node));
            }
            var bucket = buckets[bucketIndex];

            node.Queue       = this;
            node.BucketIndex = bucketIndex;
            if (bucket.Last != null)
            {
                node.Prev        = bucket.Last;
                bucket.Last.Next = node;
                bucket.Last      = node;
            }
            else
            {
                bucket.First = node;
                bucket.Last  = node;
            }
            if (lastNearestBucketIndex > bucketIndex)
            {
                lastNearestBucketIndex = bucketIndex;
            }
            count++;
        }
Ejemplo n.º 4
0
 private void ReleaseQueueNode(BucketQueueNode <Animation> node)
 {
     node.Value = null;
     freeQueueNodes.Push(node);
 }