Ejemplo n.º 1
0
        public ICarQueue CreateQueue(int size, QueueType type)
        {
            var carQueue = new CarQueue(size, type);

            if (!CarQueues.TryAdd(carQueue.Id, carQueue))
            {
                Console.WriteLine($"Queue {carQueue.Id} could not be added to local dictionary");
            }
            return(carQueue);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Compares type and count only as we are not concerened whether the capacity is more or less.
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(CarQueue other)
 {
     if (other == null)
     {
         throw new ArgumentNullException(nameof(other));
     }
     if (Type == other.Type)
     {
         return(Count.CompareTo(other.Count));
     }
     return(1);
 }