/// <summary>
 /// Takes an animal and enqueues it.
 /// </summary>
 /// <param name="animal">The animal to enqueue.</param>
 public void Enqueue(Animal animal)
 {
     animal.Data = new DateTime();
     if (animal is Dog)
     {
         Dogs.Enqueue(animal);
     }
     else if (animal is Cat)
     {
         Cats.Enqueue(animal);
     }
 }
Beispiel #2
0
        public void QueueAnimal(Node animal)
        {
            All.Enqueue(animal);

            if (animal.Value == Animal.Cat)
            {
                Cats.Enqueue(animal);
            }
            else
            {
                Dogs.Enqueue(animal);
            }
        }
Beispiel #3
0
        public void EnqueueAnimal(PseudoNode animal)
        {
            All.Enqueue(animal);

            if (animal.Type == Animal.Cat)
            {
                Cats.Enqueue(animal);
            }
            else
            {
                Dogs.Enqueue(animal);
            }
        }
Beispiel #4
0
 /// <summary>
 ///     Takes in an Animal object, and checks if it is a Cat or Dog. If it is a Cat or Dog, it places it into a new CageNode with the current
 ///      serial number, adds the CageNode to the Cats or Dogs Queue respectively, and iterates the NextSerial number, then returns true.
 ///     If the given Animal isn't a Cat or Dog, does nothing and returns false.
 /// </summary>
 /// <param name="animal"></param>
 /// <returns> Boolean indicating whether given animal was added to the Animal Shelter </returns>
 public bool Enqueue(Animal animal)
 {
     if (animal is Dog)
     {
         CageNode newCage = new CageNode(animal, NextSerial);
         Dogs.Enqueue(newCage);
         NextSerial++;
         return(true);
     }
     else if (animal is Cat)
     {
         CageNode newCage = new CageNode(animal, NextSerial);
         Cats.Enqueue(newCage);
         NextSerial++;
         return(true);
     }
     else
     {
         return(false);
     }
 }