Skip to content

Commit

Permalink
Fix copy-on-write in TimetableSnapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
vpaturet committed Jul 1, 2024
1 parent 15cf5f8 commit 42cc0fa
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/org/opentripplanner/model/TimetableSnapshot.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,15 @@ public boolean revertTripToScheduledTripPattern(FeedScopedId tripId, LocalDate s
}

if (tripTimesToRemove != null) {
for (Timetable sortedTimetable : sortedTimetables) {
boolean isDirty = sortedTimetable.getTripTimes().remove(tripTimesToRemove);
for (Timetable originalTimetable : sortedTimetables) {
boolean isDirty = originalTimetable.getTripTimes().contains(tripTimesToRemove);
if (isDirty) {
dirtyTimetables.add(sortedTimetable);
Timetable updatedTimetable = new Timetable(originalTimetable, serviceDate);
updatedTimetable.getTripTimes().remove(tripTimesToRemove);
sortedTimetables.remove(originalTimetable);
sortedTimetables.add(updatedTimetable);
dirtyTimetables.add(updatedTimetable);
dirty = true;
}
}
}
Expand Down

0 comments on commit 42cc0fa

Please sign in to comment.