File tree Expand file tree Collapse file tree
main/java/org/opentripplanner
routing/algorithm/raptoradapter/transit/mappers
test/java/org/opentripplanner/transit/model/timetable Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919import org .opentripplanner .transit .model .framework .FeedScopedId ;
2020import org .opentripplanner .transit .model .network .TripPattern ;
2121import org .opentripplanner .transit .model .timetable .Timetable ;
22- import org .opentripplanner .transit .model .timetable .TimetableSnapshotUpdateSucessListener ;
22+ import org .opentripplanner .transit .model .timetable .TimetableSnapshotUpdateListener ;
2323import org .opentripplanner .transit .model .timetable .TripIdAndServiceDate ;
2424import org .opentripplanner .transit .model .timetable .TripTimes ;
2525import org .opentripplanner .transit .service .TimetableRepository ;
3838 * incremental changes are applied to both the TimetableSnapshot and the RaptorTransitData and they are
3939 * published together.
4040 */
41- public class RealTimeRaptorTransitDataUpdater implements TimetableSnapshotUpdateSucessListener {
41+ public class RealTimeRaptorTransitDataUpdater implements TimetableSnapshotUpdateListener {
4242
4343 private static final Logger LOG = LoggerFactory .getLogger (RealTimeRaptorTransitDataUpdater .class );
4444
@@ -91,9 +91,6 @@ public RealTimeRaptorTransitDataUpdater(TimetableRepository timetableRepository)
9191 /// was for a scheduled trip, then the schedule should be restored.
9292 /// 3. Remove the `oldTripPatternsForDate` and add the `newTripPatternsForDate` to the
9393 /// [RaptorTransitData].
94- ///
95- /// @param updatedTimetables that changed with the current snapshot
96- /// @param timetables which are affected by real-time updates
9794 @ Override
9895 public void update (
9996 Collection <Timetable > updatedTimetables ,
Original file line number Diff line number Diff line change @@ -301,8 +301,6 @@ public Collection<? extends TripOnServiceDate> listRealTimeAddedTripOnServiceDat
301301 * does not exist yet in the Timetable, add it. This method will make a protective copy of the
302302 * Timetable if such a copy has not already been made while building up this snapshot, handling
303303 * both cases where patterns were pre-existing in static data or created by realtime data.
304- *
305- * @return whether the update was actually applied
306304 */
307305 public void update (RealTimeTripUpdate realTimeTripUpdate ) {
308306 validateNotReadOnly ();
@@ -368,7 +366,7 @@ public TimetableSnapshot commit() {
368366 }
369367
370368 public TimetableSnapshot commit (
371- TimetableSnapshotUpdateSucessListener updatesEventListener ,
369+ @ Nullable TimetableSnapshotUpdateListener updatesEventListener ,
372370 boolean force
373371 ) {
374372 validateNotReadOnly ();
Original file line number Diff line number Diff line change 1+ package org .opentripplanner .transit .model .timetable ;
2+
3+ import java .util .Collection ;
4+ import java .util .SortedSet ;
5+ import java .util .function .Function ;
6+ import org .opentripplanner .transit .model .framework .FeedScopedId ;
7+
8+ /**
9+ * Listener interface for receiving notifications when a {@link TimetableSnapshot}
10+ * is updated with new real-time information.
11+ * <p>
12+ * Implement this interface and inject the listener into {@link TimetableSnapshot}
13+ * to receive events after the snapshot is updated.
14+ */
15+ public interface TimetableSnapshotUpdateListener {
16+ /**
17+ * Called after the {@link TimetableSnapshot} has been updated and the commit method has completed.
18+ * <p>
19+ * This event allows the implementer to update its own state using the newly updated timetables.
20+ *
21+ * @param updatedTimetables a collection of timetables that have been updated
22+ * @param timetablesForTripPatternId a function to retrieve all timetables for a given trip pattern
23+ */
24+ void update (
25+ Collection <Timetable > updatedTimetables ,
26+ Function <FeedScopedId , SortedSet <Timetable >> timetablesForTripPatternId
27+ );
28+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ void testUniqueDirtyTimetablesAfterMultipleUpdates() {
8484
8585 AtomicBoolean updateIsCalled = new AtomicBoolean ();
8686
87- var updateListener = new TimetableSnapshotUpdateSucessListener () {
87+ var updateListener = new TimetableSnapshotUpdateListener () {
8888 @ Override
8989 public void update (
9090 Collection <Timetable > updatedTimetables ,
You can’t perform that action at this time.
0 commit comments