コード例 #1
0
 public void Clear()
 {
     Head = null;
     //while (Head != null)
     //{
     //    Head = Head.Next;
     //}
     cnt = 0;
 }
コード例 #2
0
        public void Print()
        {
            queueNode <T> tempNode = Head;

            while (tempNode != null)
            {
                Console.WriteLine(tempNode.data);
                tempNode = tempNode.Next;
            }
        }
コード例 #3
0
        public queueNode <T> Dequeue()
        {
            if (Head == null)
            {
                return(null);
            }

            queueNode <T> DeqNode = Head;

            Head = Head.Next;

            cnt--;
            return(DeqNode);
        }
コード例 #4
0
        public bool Contains(T Data)
        {
            bool          result   = false;
            queueNode <T> tempNode = Head;

            while (tempNode != null)
            {
                if (Compare(Data, tempNode.data))
                {
                    result = true;
                    break;
                }
                else
                {
                    tempNode = tempNode.Next;
                }
            }

            return(result);
        }
コード例 #5
0
        public void Enqueue(T a_data)
        {
            if (Head == null)
            {
                this.Head = new queueNode <T>();

                this.Head.data = a_data;
                this.Head.Next = null;
                Tail           = Head;
            }
            else
            {
                queueNode <T> newNode = new queueNode <T>();
                newNode.data = a_data;

                Tail.Next = newNode;
                Tail      = newNode;


                //if (Last != null) Last = tempNode;
            }

            cnt++;
        }