Exemplo n.º 1
0
 public StretchPassing(StationCall from, StationCall to) {
     if (from == null) throw new ArgumentNullException(nameof(from));
     if (to == null) throw new ArgumentNullException(nameof(to));
     if (!from.Train.Equals(to.Train)) throw new TimetableException("TODO: message");
     From = from;
     To = to;
 }
Exemplo n.º 2
0
 internal bool IsTimeslotFree(StationCall call) {
     if (!_calls.Any()) return true;
     if (_calls.Any(c => 
             (call.Departure >= c.Arrival && call.Departure <=c.Departure) || 
             (call.Arrival >= c.Arrival && call.Arrival <= c.Departure)))
         return false;
     return true;
 }
Exemplo n.º 3
0
 public void Add(StationCall call) {
     if (call == null) throw new ArgumentNullException(nameof(call));
     EnsureAscendingTimes(call);
     if (_calls.Any()) {
             call.Previous = _calls.Last();
             _calls.Last().Next = call;
     }
     call.Train = this;
     _calls.Add(call);
 }
Exemplo n.º 4
0
       internal void Add(StationCall call) {
           _calls.Add(call);
           //if (IsTimeslotFree(call))
           //    throw new TimetableException(string.Format(CultureInfo.CurrentCulture, "Timeslot confict at {0} for train {1}.", call, call.Train));
 
       }
Exemplo n.º 5
0
 private void EnsureAscendingTimes(StationCall call) {
     if (!_calls.Any()) return;
     if (call.Arrival <= _calls.Last().Departure)
         throw new TimetableException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.CallMustBeAfterPreviousCall, call, _calls.Last()));
 }