public TrackStretch(StationExit start, StationExit end, double distance, int tracksCount) { Start = start; End = end; Start.Stretch = this; End.Stretch = this; Distance = distance; TracksCount = tracksCount; }
public void Add(StationExit exit) { if (exit == null) { throw new ArgumentNullException(nameof(exit)); } exit.Station = this; Exits.Add(exit); }
public TrackStretch Add(StationExit from, StationExit to, double distance, int tracksCount) { if (from is null) { throw new ArgumentNullException(nameof(from)); } if (to is null) { throw new ArgumentNullException(nameof(to)); } if (!HasExit(from)) { throw new TrackLayoutException(string.Format(CultureInfo.CurrentCulture, Resources.Strings.StationExitIsNotInLayout, from)); } if (!HasExit(to)) { throw new TrackLayoutException(string.Format(CultureInfo.CurrentCulture, Resources.Strings.StationExitIsNotInLayout, to)); } return(Add(new TrackStretch(from, to, distance, tracksCount))); }
} // For deserialization. public TrackStretch(StationExit start, StationExit end, double distance) : this(start, end, distance, 1) { }
public TrackStretch Add(StationExit from, StationExit to, double distance) { return(Add(from, to, distance, 1)); }
public bool HasExit(StationExit exit) => StationExits.Any(e => e.Equals(exit));