Exemple #1
0
        static void ShowQueue(MyQueue myQueue)
        {
            Console.WriteLine($"Shows {nameof(myQueue)}");

            myQueue.Enqueue("Max");
            Show(nameof(myQueue), myQueue, myQueue.Capacity);
            Console.WriteLine($"Remove first");

            var first = myQueue.Dequeue();

            Show(nameof(myQueue), myQueue, myQueue.Capacity);
            Console.WriteLine();
            myQueue.Dequeue();
            // генерирует исключение
            //myQueue.Dequeue(); myQueue.Dequeue();
            Console.WriteLine("-------------------------");
        }
 public bool IsEmpty(MyQueue <T> queue)
 {
     return(queue.actualSize == 0);
 }
 public bool IsFull(MyQueue <T> queue)
 {
     return(queue.actualSize == queue.capacity);
 }