Skip to content

Commit c1c809c

Browse files
committed
Rename boolean fields in record
1 parent db7ccb4 commit c1c809c

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/ext-test/java/org/opentripplanner/ext/siri/AddedTripBuilderTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ void testAddedTrip() {
155155
assertEquals(SubMode.of(SUB_MODE), route.getNetexSubmode(), "submode should be mapped");
156156
assertNotEquals(REPLACED_ROUTE, route, "Should not re-use replaced route");
157157

158-
assertTrue(tripUpdate.isAddedRoute(), "The route is marked as created by real time updater");
158+
assertTrue(tripUpdate.routeCreation(), "The route is marked as created by real time updater");
159159

160-
assertTrue(tripUpdate.isAddedTrip(), "The trip is marked as created by real time updater");
160+
assertTrue(tripUpdate.tripCreation(), "The trip is marked as created by real time updater");
161161

162162
TripPattern pattern = tripUpdate.addedTripPattern();
163163
assertNotNull(pattern);
@@ -246,7 +246,7 @@ void testAddedTripOnAddedRoute() {
246246
.build();
247247

248248
assertTrue(firstAddedTrip.isSuccess(), "Trip creation should succeed");
249-
assertTrue(firstAddedTrip.successValue().isAddedRoute());
249+
assertTrue(firstAddedTrip.successValue().routeCreation());
250250

251251
var firstTrip = firstAddedTrip.successValue().tripTimes().getTrip();
252252

@@ -323,7 +323,7 @@ void testAddedTripOnExistingRoute() {
323323
assertSame(REPLACED_ROUTE, trip.getRoute());
324324

325325
// Assert route
326-
assertFalse(addedTrip.successValue().isAddedRoute(), "The existing route should be reused");
326+
assertFalse(addedTrip.successValue().routeCreation(), "The existing route should be reused");
327327
}
328328

329329
@Test
@@ -356,7 +356,7 @@ void testAddedTripWithoutReplacedRoute() {
356356
assertEquals(TRIP_ID, trip.getId(), "Trip should be mapped");
357357

358358
// Assert route
359-
assertTrue(addedTrip.successValue().isAddedRoute(), "A new route should be created");
359+
assertTrue(addedTrip.successValue().routeCreation(), "A new route should be created");
360360
Route route = trip.getRoute();
361361
assertEquals(LINE_REF, route.getId().getId(), "route should be mapped");
362362
assertEquals(AGENCY, route.getAgency(), "Agency should be taken from replaced route");

src/ext/java/org/opentripplanner/ext/siri/SiriTimetableSnapshotSource.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private Result<UpdateSuccess, UpdateError> addTripToGraphAndBuffer(TripUpdate tr
294294
LocalDate serviceDate = tripUpdate.serviceDate();
295295

296296
final TripPattern pattern;
297-
if (tripUpdate.isAddedTripPattern()) {
297+
if (tripUpdate.tripPatternCreation()) {
298298
pattern = tripUpdate.addedTripPattern();
299299
} else {
300300
// Get cached trip pattern or create one if it doesn't exist yet
@@ -308,8 +308,8 @@ private Result<UpdateSuccess, UpdateError> addTripToGraphAndBuffer(TripUpdate tr
308308
tripUpdate.tripTimes(),
309309
serviceDate,
310310
tripUpdate.addedTripOnServiceDate(),
311-
tripUpdate.isAddedTrip(),
312-
tripUpdate.isAddedRoute()
311+
tripUpdate.tripCreation(),
312+
tripUpdate.routeCreation()
313313
);
314314
var result = snapshotManager.updateBuffer(realTimeTripUpdate);
315315
LOG.debug("Applied real-time data for trip {} on {}", trip, serviceDate);

src/ext/java/org/opentripplanner/ext/siri/TripUpdate.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
* @param serviceDate the service date for which this update applies (updates are valid only for one service date)
1717
* @param addedTripOnServiceDate optionally if this trip update adds a new trip, the TripOnServiceDate corresponding to this new trip.
1818
* @param addedTripPattern optionally if this trip update adds a new trip pattern , the new trip pattern to this new trip.
19-
* @param isAddedRoute true if an added trip cannot be registered under an existing route and a new route must be created.
19+
* @param routeCreation true if an added trip cannot be registered under an existing route and a new route must be created.
2020
*/
2121
record TripUpdate(
2222
StopPattern stopPattern,
2323
TripTimes tripTimes,
2424
LocalDate serviceDate,
2525
@Nullable TripOnServiceDate addedTripOnServiceDate,
2626
@Nullable TripPattern addedTripPattern,
27-
boolean isAddedRoute
27+
boolean routeCreation
2828
) {
2929
public TripUpdate {
3030
Objects.requireNonNull(stopPattern);
@@ -46,14 +46,14 @@ public TripUpdate(
4646
/**
4747
* Return true if this trip update creates a new trip pattern.
4848
*/
49-
public boolean isAddedTripPattern() {
49+
public boolean tripPatternCreation() {
5050
return addedTripPattern != null;
5151
}
5252

5353
/**
5454
* Return true if this trip update creates a new trip.
5555
*/
56-
public boolean isAddedTrip() {
56+
public boolean tripCreation() {
5757
return addedTripOnServiceDate != null;
5858
}
5959
}

src/main/java/org/opentripplanner/model/RealTimeTripUpdate.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
* @param updatedTripTimes the new trip times for the updated trip.
1414
* @param serviceDate the service date for which this update applies (updates are valid only for one service date)
1515
* @param addedTripOnServiceDate optionally if this trip update adds a new trip, the TripOnServiceDate corresponding to this new trip.
16-
* @param isAddedTrip true if this update creates a new trip, not present in scheduled data.
17-
* @param isAddedRoute true if an added trip cannot be registered under an existing route and a new route must be created.
16+
* @param tripCreation true if this update creates a new trip, not present in scheduled data.
17+
* @param routeCreation true if an added trip cannot be registered under an existing route and a new route must be created.
1818
*/
1919
public record RealTimeTripUpdate(
2020
TripPattern pattern,
2121
TripTimes updatedTripTimes,
2222
LocalDate serviceDate,
2323
@Nullable TripOnServiceDate addedTripOnServiceDate,
24-
boolean isAddedTrip,
25-
boolean isAddedRoute
24+
boolean tripCreation,
25+
boolean routeCreation
2626
) {
2727
public RealTimeTripUpdate {
2828
Objects.requireNonNull(pattern);

src/main/java/org/opentripplanner/model/TimetableSnapshot.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ public Result<UpdateSuccess, UpdateError> update(RealTimeTripUpdate realTimeTrip
315315
addPatternToIndex(pattern);
316316

317317
Route route = trip.getRoute();
318-
if (realTimeTripUpdate.isAddedRoute()) {
318+
if (realTimeTripUpdate.routeCreation()) {
319319
realtimeAddedRoutes.put(route.getId(), route);
320320
}
321-
if (realTimeTripUpdate.isAddedTrip()) {
321+
if (realTimeTripUpdate.tripCreation()) {
322322
FeedScopedId tripId = trip.getId();
323323
realTimeAddedTrips.put(tripId, trip);
324324
realTimeAddedPatternForTrip.put(trip, pattern);

0 commit comments

Comments
 (0)