protected Train(TrainInfoHolder trainInfoHolder, string id) { ID = id; Type = trainInfoHolder.Type; DepartureDateTime = trainInfoHolder.DepartureDateTime; OriginStation = trainInfoHolder.OriginStation; DestinationStation = trainInfoHolder.DestinationStation; IntermediateStations = trainInfoHolder.IntermediateStations; OffersFirstClass = trainInfoHolder.OffersFirstClass; Cabin = trainInfoHolder.Cabin; }
/// <summary> /// Creates the train. /// </summary> /// <param name="trainInfoHolder">The train information holder.</param> /// <returns></returns> public Train CreateTrain(TrainInfoHolder trainInfoHolder) { var type = trainInfoHolder.Type; switch (type) { case Train.TrainType.Express: return(new ExpressTrain(trainInfoHolder, GenerateTrainID("E"))); case Train.TrainType.Stopping: return(new StoppingTrain(trainInfoHolder, GenerateTrainID("I"))); case Train.TrainType.Sleeper: return(new SleeperTrain(trainInfoHolder, GenerateTrainID("S"))); default: return(null); } }
public StoppingTrain(TrainInfoHolder trainInfoHolder, string id) : base(trainInfoHolder, id) { }
public SleeperTrain(TrainInfoHolder trainInfoHolder, string id) : base(trainInfoHolder, id) { }
public ExpressTrain(TrainInfoHolder trainInfoHolder, string id) : base(trainInfoHolder, id) { }