public virtual void AddAll(PrimitiveLongArrayQueue otherQueue)
 {
     while (!otherQueue.Empty)
     {
         Enqueue(otherQueue.Dequeue());
     }
 }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void tailBeforeHeadCorrectIteration()
        internal virtual void TailBeforeHeadCorrectIteration()
        {
            PrimitiveLongArrayQueue queue = CreateQueue();

            for (int i = 0; i < 14; i++)
            {
                queue.Enqueue(i);
            }
            for (int i = 0; i < 10; i++)
            {
                assertEquals(i, queue.Dequeue());
            }
            for (int i = 14; i < 24; i++)
            {
                queue.Enqueue(i);
            }

            assertEquals(14, queue.Size());
            LongIterator iterator = queue.LongIterator();

            for (int j = 10; j < 24; j++)
            {
                assertTrue(iterator.hasNext());
                assertEquals(j, iterator.next());
            }
            assertFalse(iterator.hasNext());
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void addRemoveElementKeepQueueEmpty()
        internal virtual void AddRemoveElementKeepQueueEmpty()
        {
            PrimitiveLongArrayQueue longArrayQueue = CreateQueue();

            for (int i = 0; i < 1000; i++)
            {
                longArrayQueue.Enqueue(i);
                assertEquals(i, longArrayQueue.Dequeue());
                assertTrue(longArrayQueue.Empty);
            }
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void tailBeforeHeadCorrectResize()
        internal virtual void TailBeforeHeadCorrectResize()
        {
            PrimitiveLongArrayQueue queue = CreateQueue();

            for (int i = 0; i < 14; i++)
            {
                queue.Enqueue(i);
            }
            for (int i = 0; i < 10; i++)
            {
                assertEquals(i, queue.Dequeue());
            }
            for (int i = 14; i < 34; i++)
            {
                queue.Enqueue(i);
            }

            assertEquals(24, queue.Size());
            for (int j = 10; j < 34; j++)
            {
                assertEquals(j, queue.Dequeue());
            }
        }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void offerMoreThenQueueCapacityElements()
        internal virtual void OfferMoreThenQueueCapacityElements()
        {
            PrimitiveLongArrayQueue arrayQueue = CreateQueue();

            for (int i = 1; i < 1234; i++)
            {
                arrayQueue.Enqueue(i);
            }
            int currentValue = 1;

            while (!arrayQueue.Empty)
            {
                assertEquals(currentValue++, arrayQueue.Dequeue());
            }
        }
Example #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void addAllElementsFromOtherQueue()
        internal virtual void AddAllElementsFromOtherQueue()
        {
            PrimitiveLongArrayQueue queue = CreateQueue();

            queue.Enqueue(1);
            queue.Enqueue(2);
            PrimitiveLongArrayQueue otherQueue = CreateQueue();

            otherQueue.Enqueue(3);
            otherQueue.Enqueue(4);
            queue.AddAll(otherQueue);

            assertTrue(otherQueue.Empty);
            assertEquals(0, otherQueue.Size());
            assertEquals(4, queue.Size());
            for (int value = 1; value <= 4; value++)
            {
                assertEquals(value, queue.Dequeue());
            }
            assertTrue(queue.Empty);
        }