Esempio n. 1
0
 public virtual void AddAll(PrimitiveLongArrayQueue otherQueue)
 {
     while (!otherQueue.Empty)
     {
         Enqueue(otherQueue.Dequeue());
     }
 }
Esempio n. 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());
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void offerLessThenQueueCapacityElements()
        internal virtual void OfferLessThenQueueCapacityElements()
        {
            PrimitiveLongArrayQueue arrayQueue = CreateQueue();

            for (int i = 1; i < 16; i++)
            {
                arrayQueue.Enqueue(i);
                assertEquals(i, arrayQueue.Size());
            }
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void growQueueOnElementOffer()
        internal virtual void GrowQueueOnElementOffer()
        {
            PrimitiveLongArrayQueue longArrayQueue = CreateQueue();

            for (int i = 1; i < 1000; i++)
            {
                longArrayQueue.Enqueue(i);
                assertEquals(i, longArrayQueue.Size());
            }
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void emptyQueueAfterClear()
        internal virtual void EmptyQueueAfterClear()
        {
            PrimitiveLongArrayQueue queue = CreateQueue();

            queue.Enqueue(2);
            queue.Enqueue(3);
            assertFalse(queue.Empty);
            assertEquals(2, queue.Size());

            queue.Clear();

            assertTrue(queue.Empty);
        }
Esempio n. 7
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());
            }
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void tailBeforeHeadCorrectSize()
        internal virtual void TailBeforeHeadCorrectSize()
        {
            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());
        }
Esempio n. 9
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);
        }
Esempio n. 10
0
 internal PrimitiveLongArrayQueueIterator(PrimitiveLongArrayQueue outerInstance)
 {
     this._outerInstance = outerInstance;
     this.Position       = outerInstance.head;
 }