From 1829ba6e8c1b025c4c8b755414e50b2047c33cff Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 5 Apr 2024 15:15:15 +0200 Subject: [PATCH 1/3] Remove backwards-compatibility with old versions of flex --- .../org/onebusaway/gtfs/model/StopTime.java | 90 +------------------ .../model/StopTimeWithUnderscoreTest.java | 4 +- .../FlexDropOffSpellingTest.java | 5 -- 3 files changed, 4 insertions(+), 95 deletions(-) diff --git a/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/model/StopTime.java b/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/model/StopTime.java index 7e9bb9a7..b80f961d 100644 --- a/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/model/StopTime.java +++ b/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/model/StopTime.java @@ -61,44 +61,12 @@ public final class StopTime extends IdentityBean implements @CsvField(optional = true, mapping = StopTimeFieldMappingFactory.class) private int departureTime = MISSING_VALUE; - /** - * @deprecated - * GTFS-Flex v2.1 renamed this field. Use {@link #startPickupDropOffWindow} instead. - */ - @Deprecated - @CsvField(optional = true, mapping = StopTimeFieldMappingFactory.class, defaultValue = "-999") - private int minArrivalTime = MISSING_VALUE; - @CsvField(optional = true, name = "start_pickup_drop_off_window", mapping = StopTimeFieldMappingFactory.class, defaultValue = "-999") private int startPickupDropOffWindow = MISSING_VALUE; - /** - * @deprecated - * GTFS-Flex v2.1 renamed "dropoff" to "drop off": https://github.com/MobilityData/gtfs-flex/commit/547200dfb580771265ae14b07d9bfd7b91c16ed2 - */ - @Deprecated - @CsvField(optional = true, name = "start_pickup_dropoff_window", mapping = StopTimeFieldMappingFactory.class, defaultValue = "-999") - public int oldSpellingOfStartPickupDropOffWindow = MISSING_VALUE; - - /** - * @deprecated - * GTFS-Flex v2.1 renamed this field. Use {@link #endPickupDropOffWindow} instead. - */ - @Deprecated - @CsvField(optional = true, mapping = StopTimeFieldMappingFactory.class, defaultValue = "-999") - private int maxDepartureTime = MISSING_VALUE; - @CsvField(optional = true, name = "end_pickup_drop_off_window", mapping = StopTimeFieldMappingFactory.class, defaultValue = "-999") private int endPickupDropOffWindow = MISSING_VALUE; - /** - * @deprecated - * GTFS-Flex v2.1 renamed "dropoff" to "drop off": https://github.com/MobilityData/gtfs-flex/commit/547200dfb580771265ae14b07d9bfd7b91c16ed2 - */ - @Deprecated - @CsvField(optional = true, name = "end_pickup_dropoff_window", mapping = StopTimeFieldMappingFactory.class, defaultValue = "-999") - public int oldSpellingOfEndPickupDropOffWindow = MISSING_VALUE; - @CsvField(optional = true, defaultValue = "-999") private int timepoint = MISSING_VALUE; @@ -192,9 +160,7 @@ public StopTime(StopTime st) { this.dropOffType = st.dropOffType; this.id = st.id; this.pickupType = st.pickupType; - this.minArrivalTime = st.minArrivalTime; this.startPickupDropOffWindow = st.startPickupDropOffWindow; - this.maxDepartureTime = st.maxDepartureTime; this.endPickupDropOffWindow = st.endPickupDropOffWindow; this.continuousPickup = st.continuousPickup; this.continuousDropOff = st.continuousDropOff; @@ -411,50 +377,17 @@ public void clearDepartureTime() { this.departureTime = MISSING_VALUE; } - @Deprecated - public int getMinArrivalTime() { - return minArrivalTime; - } - - @Deprecated - public void setMinArrivalTime(int minArrivalTime) { - this.minArrivalTime = minArrivalTime; - } public int getStartPickupDropOffWindow() { - if (startPickupDropOffWindow != MISSING_VALUE) { - return startPickupDropOffWindow; - } else if(oldSpellingOfStartPickupDropOffWindow != MISSING_VALUE){ - return oldSpellingOfStartPickupDropOffWindow; - } else { - return minArrivalTime; - } + return startPickupDropOffWindow; } public void setStartPickupDropOffWindow(int startPickupDropOffWindow) { this.startPickupDropOffWindow = startPickupDropOffWindow; } - @Deprecated - public int getMaxDepartureTime() { - return maxDepartureTime; - } - - @Deprecated - public void setMaxDepartureTime(int maxDepartureTime) { - this.maxDepartureTime = maxDepartureTime; - } - public int getEndPickupDropOffWindow() { - if (endPickupDropOffWindow != MISSING_VALUE) { - return endPickupDropOffWindow; - } - else if (oldSpellingOfEndPickupDropOffWindow != MISSING_VALUE) { - return oldSpellingOfEndPickupDropOffWindow; - } - else { - return maxDepartureTime; - } + return endPickupDropOffWindow; } public void setEndPickupDropOffWindow(int endPickupDropOffWindow) { @@ -806,30 +739,11 @@ public void setFreeRunningFlag(String freeRunningFlag) { } this.freeRunningFlag = freeRunningFlag; } - @Deprecated - public void setOldSpellingOfStartPickupDropOffWindow(int time) { - oldDropOffSpellingWarning("start"); - this.oldSpellingOfStartPickupDropOffWindow = time; - } - - @Deprecated - public void setOldSpellingOfEndPickupDropOffWindow(int time) { - oldDropOffSpellingWarning("end"); - this.oldSpellingOfEndPickupDropOffWindow = time; - } private static void oldDropOffSpellingWarning(String type) { _log.warn("This feed uses the old spelling of '{}_pickup_drop_off_window' ('dropoff' instead of 'drop_off'). " + "Compatibility will be removed in the future, so please update your feed to be in line with the latest Flex V2 spec:" + " https://github.com/MobilityData/gtfs-flex/commit/547200dfb", type); } - @Deprecated - public int getOldSpellingOfStartPickupDropOffWindow() { - return this.oldSpellingOfStartPickupDropOffWindow; - } - @Deprecated - public int getOldSpellingOfEndPickupDropOffWindow() { - return oldSpellingOfEndPickupDropOffWindow; - } } diff --git a/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/model/StopTimeWithUnderscoreTest.java b/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/model/StopTimeWithUnderscoreTest.java index 9a5240a7..3a4396b5 100644 --- a/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/model/StopTimeWithUnderscoreTest.java +++ b/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/model/StopTimeWithUnderscoreTest.java @@ -80,7 +80,7 @@ public void testWithoutUnderscore() throws IOException { _gtfs.putDefaultTrips(); _gtfs.putDefaultStops(); _gtfs.putLines("stop_times.txt", - "trip_id,stop_id,stop_sequence,arrival_time,departure_time,end_pickup_dropoff_window", + "trip_id,stop_id,stop_sequence,arrival_time,departure_time,end_pickup_drop_off_window", "T10-0,100,0,05:55:55,08:00:00,08:23:23", "T10-0,200,1,05:55:55,09:00:00,08:44:44"); GtfsRelationalDao dao = _gtfs.read(); @@ -94,7 +94,7 @@ public void testWithoutUnderscore() throws IOException { boolean foundUnderscoreParam = false; while(scan.hasNext()){ String line = scan.nextLine(); - if(line.contains("end_pickup_dropoff_window")){ + if(line.contains("end_pickup_drop_off_window")){ foundUnderscoreParam = true; } } diff --git a/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java b/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java index d5bb63ad..d17a70fa 100644 --- a/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java +++ b/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java @@ -39,11 +39,6 @@ */ public class FlexDropOffSpellingTest { - @Test - public void oldSpelling() throws IOException { - testFlexStopTimeWithSpelling("dropoff"); - } - @Test public void newSpelling() throws IOException { testFlexStopTimeWithSpelling("drop_off"); From b82e526f2a88b94346c46fdcf8fba3cac6f7ceed Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 5 Apr 2024 15:20:03 +0200 Subject: [PATCH 2/3] Update Javadoc --- .../onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java b/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java index d17a70fa..8848fc88 100644 --- a/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java +++ b/onebusaway-gtfs/src/test/java/org/onebusaway/gtfs/serialization/FlexDropOffSpellingTest.java @@ -35,7 +35,7 @@ * * Since it's hard to spot: the change is in the word "dropoff" vs "drop_off". * - * This test makes sure that both spellings are understood. + * This test makes sure that the new spelling is understood. */ public class FlexDropOffSpellingTest { From 3d26010223034ac60e30ff9a3c2cd85e2bcb1247 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Mon, 6 May 2024 18:00:33 +0200 Subject: [PATCH 3/3] Remove unused method --- .../src/main/java/org/onebusaway/gtfs/model/StopTime.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/model/StopTime.java b/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/model/StopTime.java index b80f961d..95c0307b 100644 --- a/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/model/StopTime.java +++ b/onebusaway-gtfs/src/main/java/org/onebusaway/gtfs/model/StopTime.java @@ -740,10 +740,4 @@ public void setFreeRunningFlag(String freeRunningFlag) { this.freeRunningFlag = freeRunningFlag; } - private static void oldDropOffSpellingWarning(String type) { - _log.warn("This feed uses the old spelling of '{}_pickup_drop_off_window' ('dropoff' instead of 'drop_off'). " - + "Compatibility will be removed in the future, so please update your feed to be in line with the latest Flex V2 spec:" - + " https://github.com/MobilityData/gtfs-flex/commit/547200dfb", type); - } - }