Beispiel #1
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());
            PrimitiveLongIterator iterator = queue.GetEnumerator();

            for (int j = 10; j < 24; j++)
            {
                assertTrue(iterator.HasNext());
                assertEquals(j, iterator.Next());
            }
            assertFalse(iterator.HasNext());
        }
Beispiel #2
0
 public virtual void AddAll(PrimitiveLongArrayQueue otherQueue)
 {
     while (!otherQueue.Empty)
     {
         Enqueue(otherQueue.Dequeue());
     }
 }
Beispiel #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());
            }
        }
Beispiel #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());
            }
        }
Beispiel #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);
            }
        }
Beispiel #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);
        }
Beispiel #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());
            }
        }
Beispiel #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());
        }
Beispiel #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);
        }
Beispiel #10
0
 internal PrimitiveLongArrayQueueIterator(PrimitiveLongArrayQueue outerInstance)
 {
     this._outerInstance = outerInstance;
     this.Position       = outerInstance.head;
 }