public void Enqueue(T item, int priority)
        {
            if (priority > priorityList.Size() || priorityList.Get(priority) == null)
            {
                priorityList.Add(new Queue <T>(), priority);
            }

            priorityList.Get(priority).Enqueue(item);
            size += 1;
        }
Exemplo n.º 2
0
        public void Add(T item)
        {
            if (size == array.Size() * vector)
            {
                array.Add(new VectorArray <T>(vector));
            }

            int index = Size();

            if (array.Get(index / vector) != null)
            {
                array.Get(index / vector).Add(item);
                size += 1;
            }
            else
            {
                array.Add(new VectorArray <T>(vector), index / vector);
                array.Get(index / vector).Add(item);
            }
        }