Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
else
{
<table class="table table-striped table-hover">
<table class="table table-striped table-hover text-nowrap">
<thead>
<tr>
<th scope="col">
Expand Down
3 changes: 2 additions & 1 deletion VipTimetable/Lines/Bus605/Bus605.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ namespace VipTimetable.Lines.Bus605;

internal class Bus605 : ICompleteLine
{
public IEnumerable<ILineInstance> LineInstances { get; } = [new Bus605From20241214(), new Bus605From20241215()];
public IEnumerable<ILineInstance> LineInstances { get; } =
[new Bus605From20241214(), new Bus605From20241215(), new Bus605From20250203()];
}
164 changes: 164 additions & 0 deletions VipTimetable/Lines/Bus605/Bus605From20250203.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
using Timetable;
using static VipTimetable.Minutes;

namespace VipTimetable.Lines.Bus605;

public class Bus605From20250203 : ILineInstance
{
public DateOnly ValidFrom { get; } = new(2025, 2, 3);
private static Bus605From20241215 Previous { get; } = new();

public Line Line { get; } = Previous.Line with
{
Routes =
[
Previous.Line.Routes[0] with
{
TimeProfiles =
[
..Previous.Line.Routes[0].TimeProfiles,
new Line.Route.TimeProfile
{
StopDistances =
[
M1, M1, M1, M1, M2, M1, M1, M1, M1, M1, M2, M1, M1, M0, M2, M2, M2, M2, M1, M1, M2, M1, M2,
M1, M3,
],
},
],
},
..Previous.Line.Routes[1..]
],
TripsCreate =
[
..Previous.Line.TripsCreate.Where(trip =>
{
if (trip.RouteIndex.Equals(1) && new TimeOnly(7, 52) <= trip.StartTime &&
trip.StartTime <= new TimeOnly(13, 54))
{
return false;
}

if (trip.RouteIndex.Equals(1) && trip.StartTime > new TimeOnly(16, 40))
{
return false;
}

if (trip.RouteIndex.Equals(0) && trip.DaysOfOperation == DaysOfOperation.School)
{
return false;
}

if (trip.RouteIndex.Equals(5) && new TimeOnly(8, 10) <= trip.StartTime &&
trip.StartTime <= new TimeOnly(14, 30))
{
return false;
}

if (trip.RouteIndex.Equals(5) && trip.StartTime >= new TimeOnly(17, 10))
{
return false;
}

return true;
}).SelectMany(trip =>
{
Line.TripCreate[]? returnTrips = null;
if (trip.RouteIndex.Equals(0) && new TimeOnly(7, 0) <= trip.StartTime &&
trip.StartTime <= new TimeOnly(10, 0))
{
var startTimeDiffMinutes = trip.StartTime < new TimeOnly(9, 0) ? -1 : -3;
returnTrips =
[
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekday,
TimeProfileIndex = 4,
StartTime = trip.StartTime.AddMinutes(startTimeDiffMinutes),
},
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekend,
},
];
}
else if (trip.RouteIndex.Equals(0) && new TimeOnly(13, 10) <= trip.StartTime &&
trip.StartTime <= new TimeOnly(17, 30))
{
var startTimeDiffMinutes =
trip.StartTime > new TimeOnly(14, 30) && trip.StartTime < new TimeOnly(16, 40) ? -1 : -3;
returnTrips =
[
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekday,
TimeProfileIndex = 4,
StartTime = trip.StartTime.AddMinutes(startTimeDiffMinutes),
},
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekend,
},
];
}

else if (trip.RouteIndex.Equals(1) && new TimeOnly(14, 0) <= trip.StartTime &&
trip.StartTime <= new TimeOnly(14, 40))
{
returnTrips =
[
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekday,
TimeProfileIndex = 1,
StartTime = trip.StartTime.AddMinutes(-2),
},
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekend,
},
];
}

else if (trip.RouteIndex.Equals(4) && trip.StartTime == new TimeOnly(10, 4))
{
returnTrips =
[
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekday,
},
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekend,
TimeProfileIndex = 1,
},
];
}

return returnTrips ?? [trip];
}).Where(trip => trip.DaysOfOperation is not DaysOfOperation.None),
..new Line.TripCreate
{
RouteIndex = 0,
TimeProfileIndex = 4,
DaysOfOperation = DaysOfOperation.School,
StartTime = new TimeOnly(7, 50),
}.AlsoEvery(M20, 3),
..new Line.TripCreate
{
RouteIndex = 0,
TimeProfileIndex = 4,
DaysOfOperation = DaysOfOperation.School,
StartTime = new TimeOnly(16, 50),
}.AlsoEvery(M20, 3),
..new Line.TripCreate
{
RouteIndex = 4,
TimeProfileIndex = 1,
DaysOfOperation = DaysOfOperation.School,
StartTime = new TimeOnly(13, 34),
}.AlsoEvery(M20, 3),
],
};
}
3 changes: 2 additions & 1 deletion VipTimetable/Lines/Bus612/Bus612.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ namespace VipTimetable.Lines.Bus612;

internal class Bus612 : ICompleteLine
{
public IEnumerable<ILineInstance> LineInstances { get; } = [new Bus612From20241214(), new Bus612From20241215()];
public IEnumerable<ILineInstance> LineInstances { get; } =
[new Bus612From20241214(), new Bus612From20241215(), new Bus612From20250203()];
}
107 changes: 107 additions & 0 deletions VipTimetable/Lines/Bus612/Bus612From20250203.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using Timetable;
using static VipTimetable.Minutes;

namespace VipTimetable.Lines.Bus612;

public class Bus612From20250203 : ILineInstance
{
public DateOnly ValidFrom { get; } = new(2025, 2, 3);
private static Bus612From20241215 Previous { get; } = new();

public Line Line { get; } = Previous.Line with
{
Routes =
[
Previous.Line.Routes[0] with
{
TimeProfiles =
[
..Previous.Line.Routes[0].TimeProfiles,
new Line.Route.TimeProfile
{
StopDistances =
[
M1, M1, M0, M1, M2, M1, M1, M2, M2, M2, M1, M3, M1, M1, M1, M1, M2, M1, M1, M1, M1, M1, M2,
M3, M3, M2, M1, M2,
],
},
]
},
..Previous.Line.Routes[1..2],
Previous.Line.Routes[2] with
{
TimeProfiles =
[
new Line.Route.TimeProfile
{
StopDistances =
[
M1, M1, M0, M1, M2, M1, M1, M2, M2, M2, M1, M1, M1, M1, M1, M0, M2, M1, M2, M3, M2, M1, M2,
M1,
],
},
],
},
Previous.Line.Routes[3] with
{
TimeProfiles =
[
..Previous.Line.Routes[3].TimeProfiles,
new Line.Route.TimeProfile
{
StopDistances =
[
M2, M1, M3, M2, M1, M1, M1, M0, M0, M1, M0, M2, M1, M1, M1, M1, M2, M3, M1, M1, M1, M1, M1,
M1, M1, M1, M0, M0, M1, M1,
],
},
],
},
],
TripsCreate = Previous.Line.TripsCreate.SelectMany(trip =>
{
Line.TripCreate[]? returnTrips = null;
if (trip.RouteIndex.Equals(0) && new TimeOnly(6, 20) <= trip.StartTime &&
trip.StartTime <= new TimeOnly(9, 0))
{
returnTrips =
[
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekday,
StartTime = trip.StartTime.AddMinutes(-2),
TimeProfileIndex = 4,
},
trip with
{
DaysOfOperation = trip.DaysOfOperation & DaysOfOperation.Weekend,
},
];
}

else if (trip.RouteIndex.Equals(2))
{
returnTrips =
[
trip with
{
StartTime = trip.StartTime.AddMinutes(-2),
}
];
}

else if (trip.RouteIndex.Equals(3) && trip.StartTime > new TimeOnly(19, 45))
{
returnTrips =
[
trip with
{
TimeProfileIndex = 3,
},
];
}

return returnTrips ?? [trip];
}).Where(trip => trip.DaysOfOperation is not DaysOfOperation.None).ToArray(),
};
}
2 changes: 1 addition & 1 deletion VipTimetable/Lines/Bus616/Bus616.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ namespace VipTimetable.Lines.Bus616;

internal class Bus616 : ICompleteLine
{
public IEnumerable<ILineInstance> LineInstances { get; } = [new Bus616From20241214()];
public IEnumerable<ILineInstance> LineInstances { get; } = [new Bus616From20241214(), new Bus616From20250203()];
}
2 changes: 1 addition & 1 deletion VipTimetable/Lines/Bus616/Bus616From20241214.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Bus616From20241214 : ILineInstance
new Line.Route.TimeProfile
{ StopDistances = [M2, M1, M1, M2, M1, M1, M1, M1, M1, M1, M1, M1, M1, M2] }
],
CommonStopIndex = 5,
CommonStopIndex = 5 /* Schloss Babelsberg */,
},
new Line.Route
{
Expand Down
45 changes: 45 additions & 0 deletions VipTimetable/Lines/Bus616/Bus616From20250203.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Timetable;
using static VipTimetable.Minutes;

namespace VipTimetable.Lines.Bus616;

public class Bus616From20250203 : ILineInstance
{
public DateOnly ValidFrom { get; } = new(2025, 2, 3);
private static Bus616From20241214 Previous { get; } = new();

public Line Line { get; } = Previous.Line with
{
Routes =
[
Previous.Line.Routes[0], Previous.Line.Routes[1] with
{
TimeProfiles =
[
new Line.Route.TimeProfile
{ StopDistances = [M1, M1, M1, M1, M2, M1, M1, M1, M1, M1, M2, M0, M1, M1,], },
],
},
],
TripsCreate = Previous.Line.TripsCreate.Select(trip =>
{
ReadOnlySpan<TimeOnly> cancelledTowardsGriebnitzsee =
[
new(6, 53), new(7, 33), new(8, 13), new(8, 53), new(13, 33), new(14, 13), new(14, 53), new(15, 33),
new(16, 13)
];
ReadOnlySpan<TimeOnly> cancelledTowardsBabelsberg =
[
new(7, 14), new(7, 54), new(8, 34), new(13, 14), new(13, 54), new(14, 34), new(15, 14), new(15, 54),
new(16, 34),
];
if (trip.RouteIndex.Equals(0) && cancelledTowardsGriebnitzsee.Contains(trip.StartTime) ||
trip.RouteIndex.Equals(1) && cancelledTowardsBabelsberg.Contains(trip.StartTime))
return trip with
{
DaysOfOperation = trip.DaysOfOperation & (DaysOfOperation.School | DaysOfOperation.Weekend)
};
return trip;
}).Where(trip => trip.DaysOfOperation is not DaysOfOperation.None).ToArray(),
};
}
3 changes: 2 additions & 1 deletion VipTimetable/Lines/Bus638/Bus638.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ namespace VipTimetable.Lines.Bus638;

internal class Bus638 : ICompleteLine
{
public IEnumerable<ILineInstance> LineInstances { get; } = [new Bus638From20241214(), new Bus638From20241215()];
public IEnumerable<ILineInstance> LineInstances { get; } =
[new Bus638From20241214(), new Bus638From20241215(), new Bus638From20250203()];
}
Loading