コード例 #1
0
 public void AddCar(Car car)
 {
     foreach (var group in _groups)
      {
     if (group.Value.Cars.Count() < _carsPerProcessor)
     {
        group.Value.Cars.Add(car);
        return;
     }
      }
      CreateGroup(new List<Car> { car });
 }
コード例 #2
0
 public void Enqueue(Message message, Car car, Priority priority = Priority.Low)
 {
     MessageQueue queue;
      if (_queueLookup.TryGetValue(car, out queue))
      {
     queue.Add(message, priority);
      }
 }
コード例 #3
0
 private void RemoveCarFromGroup(Car car)
 {
     foreach (var group in _groups)
      {
     Car carToRemove = null;
     foreach (var trackedCar in @group.Value.Cars)
     {
        if (trackedCar == car)
        {
           carToRemove = trackedCar;
        }
     }
     if (carToRemove != null)
     {
        group.Value.Cars.Remove(carToRemove);
     }
      }
 }
コード例 #4
0
 public void RemoveCar(Car car)
 {
     _queueLookup.Remove(car);
      RemoveCarFromGroup(car);
      RemoveUnNeededGroups();
 }