Esempio n. 1
0
        public void DequeueCat()
        {
            //Remove from the cat list.
            var adoptedCat = Cats.Dequeue();

            //Then remove from the overall list.
            All.DequeueAny(adoptedCat);
        }
 /// <summary>
 /// Dequeues a specific animal type or the oldest animal.
 /// </summary>
 /// <param name="type">the Type of animal</param>
 /// <returns>The oldest animal of the requested type</returns>
 public Node <DateTime> Dequeue(string type = null)
 {
     if (type == "dog")
     {
         return(Dogs.Dequeue());
     }
     else if (type == "cat")
     {
         return(Cats.Dequeue());
     }
     else
     {
         return((Dogs.Peek().Data.CompareTo(Cats.Peek().Data) < 0)? Dogs.Dequeue() : Cats.Dequeue());
     }
 }
Esempio n. 3
0
 public Animal Dequeue(string pref)
 {
     if (pref.ToLower() == "cat")
     {
         if (Cats.Peek() != null)
         {
             return(Cats.Dequeue().Holds);
         }
     }
     else if (pref.ToLower() == "dog")
     {
         if (Dogs.Peek() != null)
         {
             return(Dogs.Dequeue().Holds);
         }
     }
     return(null);
 }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public Animal Dequeue()
 {
     if (Dogs.Peek() != null && Cats.Peek() != null)
     {
         return(Dogs.Peek().Serial < Cats.Peek().Serial ? Dogs.Dequeue().Holds : Cats.Dequeue().Holds);
     }
     else if (Dogs.Peek() == null && Cats.Peek() == null)
     {
         return(null);
     }
     else if (Dogs.Peek() == null)
     {
         return(Cats.Dequeue().Holds);
     }
     else
     {
         return(Dogs.Dequeue().Holds);
     }
 }
Esempio n. 5
0
        public void DequeueCat()
        {
            var catNoMore = Cats.Dequeue();

            All.DequeueOne(catNoMore);
        }