public ProcessStrategy createProcessStrategy(AthleteUpdate update) { ProcessStrategy strategy = null; if (update.UpdateType == AthleteRaceStatus.Registered) { strategy = new RegistrationHandler(); } else if (update.UpdateType == AthleteRaceStatus.DidNotStart) { strategy = new DidNotStartHandler(); } else if (update.UpdateType == AthleteRaceStatus.Started) { strategy = new StartedHandler(); } else if (update.UpdateType == AthleteRaceStatus.OnCourse) { strategy = new LocationHandler(); } else if (update.UpdateType == AthleteRaceStatus.DidNotFinish) { strategy = new DidNotFinishHandler(); } else if (update.UpdateType == AthleteRaceStatus.Finished) { strategy = new FinishedHandler(); } return(strategy); }
public void ProcessUpdate(AthleteUpdate updateMessage) { //Console.WriteLine(updateMessage.ToString()); // TODO: Do something to process the update message, depending on the concrete type of message MyProcessStrategy = strategyFactory.createProcessStrategy(updateMessage); MyProcessStrategy.Process(updateMessage, ProcessorAthleteList); // TODO: Note that the console write line does below here }