Пример #1
0
 private bool IsTimeslotFree(StretchPassing link) {
     if (_passings.Where(p => 
             (link.Departure >= p.Departure && link.Departure < p.Arrival) || 
             (link.Arrival > p.Departure && link.Arrival <= p.Arrival)).Count() > TracksCount)
         return false;
     return true;
 }
Пример #2
0
 internal void Add(StretchPassing link) {
     if (link == null) throw new ArgumentNullException(nameof(link));
     if (!IsTimeslotFree(link)) {
         throw new TimetableException("Timeslot not free."); }
     link.TrackLink = this;
     _passings.Add(link);
 }