Exemplo n.º 1
0
        public SeanQueue(T newName)
        {
            SeanNode <T> newHead = new SeanNode <T>(newName);

            head = newHead;
            tail = newHead;
            Size++;
        }
Exemplo n.º 2
0
 public void Pop()
 {
     if (head != null)
     {
         if (head.Child == null)
         {
             head = null;
             tail = null;
             Size--;
         }
         else
         {
             head        = head.Child;
             head.Parent = null;
             Size--;
         }
     }
 }
Exemplo n.º 3
0
 public void Push(T newName)
 {
     if (head == null)
     {
         SeanNode <T> newHead = new SeanNode <T>(newName);
         head = newHead;
         tail = newHead;
         Size++;
     }
     else
     {
         SeanNode <T> newTail = new SeanNode <T>(newName);
         SeanNode <T> oldTail = tail;
         tail.Child  = newTail;
         tail        = tail.Child;
         tail.Parent = oldTail;
         Size++;
     }
 }
Exemplo n.º 4
0
        public T Poll()
        {
            T returnVal = default(T);

            if (head != null)
            {
                returnVal = head.Name;

                if (head.Child == null)
                {
                    head = null;
                    tail = null;
                    Size--;
                }
                else
                {
                    head        = head.Child;
                    head.Parent = null;
                    Size--;
                }
            }

            return(returnVal);
        }