Пример #1
0
 public override void Push(Bag bagtoqueue)
 {
     if (bagtoqueue.IsNull())
     {
         return;
     }
     lock (BagsQueue)
     {
         if (BagsQueue.Count >= _setsize)
         {
             return;
         }
         BagsQueue.Enqueue(bagtoqueue);
         IsEmpty = false;
         var count = BagsQueue.Count;
         if (count < _setsize - 1)
         {
             BagsQueue.Enqueue(null);
         }
         if (count == _setsize)
         {
             IsFull = true;
         }
     }
     OnQueueChangedEventHandler?.Invoke(this, EventArgs.Empty);
 }
 public override void Push(Bag bagtoqueue)
 {
     if (bagtoqueue == null)
     {
         return;
     }
     lock (BagsQueue)
     {
         if (BagsQueue.Count >= _setsize)
         {
             return;
         }
         BagsQueue.Enqueue(bagtoqueue);
         IsEmpty = false;
         var count = BagsQueue.Count;
         if (count < _setsize - 1)
         {
             BagsQueue.Enqueue(null);
         }
         if (count == _setsize)
         {
             IsFull = true;
         }
     }
 }
        public override Bag Remove()
        {
            lock (BagsQueue)
            {
                if (BagsQueue.Count < 1)
                {
                    IsEmpty = true;
                    return(null);
                }

                var bag = BagsQueue.Dequeue();
                IsFull = false;
                return(bag);
            }
        }
Пример #4
0
        public override Bag Remove()
        {
            Bag bag;

            lock (BagsQueue)
            {
                if (BagsQueue.Count < 1)
                {
                    IsEmpty = true;
                    return(null);
                }

                bag    = BagsQueue.Dequeue();
                IsFull = false;
            }
            OnQueueChangedEventHandler?.Invoke(this, EventArgs.Empty);
            return(bag);
        }