/// <summary> /// /// </summary> /// <param name="train"></param> /// <param name="harbor"></param> /// <param name="callCount"></param> /// <returns></returns> public override TimeLength getStopTimeSpan(Train train, ITrainHarbor harbor, int callCount) { // stop 1 hour and go if (!(harbor is Station)) { return(TimeLength.ZERO); // ignore everything but a station } if (callCount == 0) { return(TimeLength.fromMinutes(30)); } else { return(TimeLength.ZERO); } }
/// <summary> /// /// </summary> /// <param name="train"></param> /// <param name="harbor"></param> /// <param name="callCount"></param> /// <returns></returns> public override TimeLength getStopTimeSpan(Train train, ITrainHarbor harbor, int callCount) { return(findController(train).getStopTimeSpan(train, harbor, callCount)); }
/// <summary> /// This method is called when a train hits the stop position /// of a platform (or other train harbors.) /// </summary> /// <param name="callCount"> /// This value is 0 when this method is called /// first time (when a train stops at a station.) /// After the given time is elapsed, the onStop method will be /// called again but this time with callCount==1. The value /// keeps increasing as this process repeats. /// </param> /// <returns> /// returns the amount of time the train should stop. /// after this time span, the train will call this same method /// so the train controller still has a chance to postpone the /// departure. Return 0 to make the train proceed, or return /// -1 to make the train turn around. /// /// Returning 0 when callCount==0 means the train will not stop /// at the specified platform. /// </returns> /// <param name="platform"></param> /// <param name="train"></param> public abstract TimeLength getStopTimeSpan(Train train, ITrainHarbor platform, int callCount);