using System;
using System.Collections;
using QCGM.Graphs2;

namespace QCGM.Graphs2
{
	/// <summary>
	/// Summary description for SimpleQueue.
	/// </summary>
	public class SimpleQueue 
	{
		private ArrayList list = new ArrayList();

		public SimpleQueue()
		{
		}

		public int Count
		{
			get
			{
				return list.Count;
			}
		}


		public void Enqueue(Node2 n)
		{
			for(int i=0; i < list.Count; i++)
			{
				Node2 q = (Node2)list[i];

				if(n.BFS_d < q.BFS_d)
				{
					list.Insert(i, n);
					return;
				}
			}

			list.Add(n);
		}

		public Node2 ExtractMin()
		{
			Node2 n = (Node2)list[0];
			list.RemoveAt(0);
			return n;
		}
	}
}
