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()); } }
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); }
/// <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); } }
public void DequeueCat() { var catNoMore = Cats.Dequeue(); All.DequeueOne(catNoMore); }