Skip to content

Commit 6cfe91c

Browse files
committed
Run openrewrite recipes
1 parent d2b9822 commit 6cfe91c

File tree

220 files changed

+1116
-500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+1116
-500
lines changed

application/src/ext-test/java/org/opentripplanner/ext/emission/internal/csvdata/EmissionDataReaderTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717

1818
class EmissionDataReaderTest implements EmissionTestData {
1919

20-
private TimetableRepositoryForTest data = TimetableRepositoryForTest.of();
20+
private final TimetableRepositoryForTest data = TimetableRepositoryForTest.of();
2121
private final EmissionRepository repository = new DefaultEmissionRepository();
22-
private DataImportIssueStore issueStore = new DefaultDataImportIssueStore();
22+
private final DataImportIssueStore issueStore = new DefaultDataImportIssueStore();
2323

24-
private StopLocation STOP_A = data.stop("A").build();
25-
private StopLocation STOP_B = data.stop("B").build();
26-
private StopLocation STOP_C = data.stop("C").build();
24+
private final StopLocation STOP_A = data.stop("A").build();
25+
private final StopLocation STOP_B = data.stop("B").build();
26+
private final StopLocation STOP_C = data.stop("C").build();
2727

28-
private Map<FeedScopedId, List<StopLocation>> stopsByTripId = Map.of(
28+
private final Map<FeedScopedId, List<StopLocation>> stopsByTripId = Map.of(
2929
new FeedScopedId("em", "T1"),
3030
List.of(STOP_A, STOP_B, STOP_C),
3131
new FeedScopedId("em", "T2"),
3232
List.of(STOP_A, STOP_B, STOP_C)
3333
);
3434

35-
private TripHopMapper tripHopMapper = new TripHopMapper(stopsByTripId, issueStore);
35+
private final TripHopMapper tripHopMapper = new TripHopMapper(stopsByTripId, issueStore);
3636

3737
private final EmissionDataReader subject = new EmissionDataReader(
3838
repository,

application/src/ext/java/org/opentripplanner/ext/debugrastertiles/EdgeVertexTileRenderer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ public void renderTile(TileRenderContext context) {
149149
midLineGeom.getCoordinates(),
150150
lineWidth * 0.4
151151
);
152-
if (coords.length < 2) continue; // Can happen for very small edges (<1mm)
152+
if (coords.length < 2) {
153+
continue; // Can happen for very small edges (<1mm)
154+
}
153155
LineString offsetLine = GeometryUtils.makeLineString(coords);
154156
Shape midLineShape = shapeWriter.toShape(midLineGeom);
155157
Shape offsetShape = shapeWriter.toShape(offsetLine);
@@ -225,7 +227,9 @@ public void renderTile(TileRenderContext context) {
225227
* need to expand the envelope by an unbounded amount (max label size).
226228
*/
227229
double x = tilePoint.getX();
228-
if (x + labelWidth > context.tileWidth) x -= labelWidth;
230+
if (x + labelWidth > context.tileWidth) {
231+
x -= labelWidth;
232+
}
229233
context.graphics.drawString(vvAttrs.label, (float) x, (float) tilePoint.getY());
230234
}
231235
}

application/src/ext/java/org/opentripplanner/ext/debugrastertiles/TileRenderer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ abstract class TileRenderContext {
3838
public double metersPerPixel;
3939

4040
/** Tile size in pixels */
41-
public int tileWidth, tileHeight;
41+
public int tileWidth;
42+
public int tileHeight;
4243

4344
/** Expand the bounding box to add some margins, in pixel size. */
4445
public abstract Envelope expandPixels(double marginXPixels, double marginYPixels);

application/src/ext/java/org/opentripplanner/ext/debugrastertiles/TileRendererManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public Envelope expandPixels(double marginXPixels, double marginYPixels) {
6060
context.graph = graph;
6161

6262
TileRenderer renderer = renderers.get(layer);
63-
if (renderer == null) throw new IllegalArgumentException("Unknown layer: " + layer);
63+
if (renderer == null) {
64+
throw new IllegalArgumentException("Unknown layer: " + layer);
65+
}
6466

6567
// The best place for caching tiles may be here
6668
BufferedImage image = new BufferedImage(

application/src/ext/java/org/opentripplanner/ext/debugrastertiles/TraversalPermissionsEdgeRenderer.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,15 @@ private Color getColor(StreetTraversalPermission permissions) {
140140

141141
private String getLabel(StreetTraversalPermission permissions) {
142142
StringBuilder sb = new StringBuilder();
143-
if (permissions.allows(StreetTraversalPermission.PEDESTRIAN)) sb.append("walk,");
144-
if (permissions.allows(StreetTraversalPermission.BICYCLE)) sb.append("bike,");
145-
if (permissions.allows(StreetTraversalPermission.CAR)) sb.append("car,");
143+
if (permissions.allows(StreetTraversalPermission.PEDESTRIAN)) {
144+
sb.append("walk,");
145+
}
146+
if (permissions.allows(StreetTraversalPermission.BICYCLE)) {
147+
sb.append("bike,");
148+
}
149+
if (permissions.allows(StreetTraversalPermission.CAR)) {
150+
sb.append("car,");
151+
}
146152
if (sb.length() > 0) {
147153
sb.setLength(sb.length() - 1); // Remove last comma
148154
} else {

application/src/ext/java/org/opentripplanner/ext/emission/internal/DefaultEmissionRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
public class DefaultEmissionRepository implements EmissionRepository {
1414

1515
private Emission carAvgCo2PerMeter = Emission.ZERO;
16-
private Map<FeedScopedId, Emission> emissionForRouteId = new HashMap<>();
17-
private Map<FeedScopedId, TripPatternEmission> emissionForTripId = new HashMap<>();
16+
private final Map<FeedScopedId, Emission> emissionForRouteId = new HashMap<>();
17+
private final Map<FeedScopedId, TripPatternEmission> emissionForTripId = new HashMap<>();
1818

1919
public DefaultEmissionRepository() {}
2020

application/src/ext/java/org/opentripplanner/ext/emission/internal/csvdata/trip/TripHopMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
public class TripHopMapper {
1212

1313
private String currentFeedId;
14-
private Map<FeedScopedId, List<StopLocation>> stopsByTripId;
15-
private DataImportIssueStore issueStore;
14+
private final Map<FeedScopedId, List<StopLocation>> stopsByTripId;
15+
private final DataImportIssueStore issueStore;
1616

1717
public TripHopMapper(
1818
Map<FeedScopedId, List<StopLocation>> stopsByTripId,

application/src/ext/java/org/opentripplanner/ext/fares/impl/AtlantaFareService.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ private static TransferMeta classifyTransfer(
285285
default -> new TransferMeta(TransferType.NO_TRANSFER);
286286
};
287287
case MARTA:
288-
if (!isElectronicPayment(fareType)) return new TransferMeta(TransferType.END_TRANSFER);
288+
if (!isElectronicPayment(fareType)) {
289+
return new TransferMeta(TransferType.END_TRANSFER);
290+
}
289291
return switch (fromRideType) {
290292
case MARTA,
291293
XPRESS_AFTERNOON,
@@ -300,7 +302,9 @@ private static TransferMeta classifyTransfer(
300302
case XPRESS_MORNING:
301303
case XPRESS_AFTERNOON:
302304
boolean payOnExit = toRideType == RideType.XPRESS_AFTERNOON;
303-
if (!isElectronicPayment(fareType)) return new TransferMeta(TransferType.END_TRANSFER);
305+
if (!isElectronicPayment(fareType)) {
306+
return new TransferMeta(TransferType.END_TRANSFER);
307+
}
304308
return switch (fromRideType) {
305309
case MARTA,
306310
COBB_EXPRESS,
@@ -325,7 +329,9 @@ private static TransferMeta classifyTransfer(
325329
default -> new TransferMeta(TransferType.END_TRANSFER);
326330
};
327331
case GCT_LOCAL:
328-
if (!isElectronicPayment(fareType)) return new TransferMeta(TransferType.END_TRANSFER);
332+
if (!isElectronicPayment(fareType)) {
333+
return new TransferMeta(TransferType.END_TRANSFER);
334+
}
329335
return switch (fromRideType) {
330336
case MARTA, GCT_LOCAL, GCT_EXPRESS_Z1, GCT_EXPRESS_Z2 -> new TransferMeta(
331337
TransferType.FREE_TRANSFER
@@ -334,7 +340,9 @@ private static TransferMeta classifyTransfer(
334340
};
335341
case GCT_EXPRESS_Z1:
336342
case GCT_EXPRESS_Z2:
337-
if (!isElectronicPayment(fareType)) return new TransferMeta(TransferType.END_TRANSFER);
343+
if (!isElectronicPayment(fareType)) {
344+
return new TransferMeta(TransferType.END_TRANSFER);
345+
}
338346
return switch (fromRideType) {
339347
case MARTA -> new TransferMeta(TransferType.FREE_TRANSFER);
340348
case GCT_LOCAL, GCT_EXPRESS_Z1, GCT_EXPRESS_Z2 -> new TransferMeta(

application/src/ext/java/org/opentripplanner/ext/fares/impl/OrcaFareService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,9 @@ private static boolean inFreeTransferWindow(
633633
ZonedDateTime currentLegStartTime
634634
) {
635635
// If there is no free transfer, then return false.
636-
if (freeTransferStartTime == null) return false;
636+
if (freeTransferStartTime == null) {
637+
return false;
638+
}
637639
Duration duration = Duration.between(freeTransferStartTime, currentLegStartTime);
638640
return duration.compareTo(MAX_TRANSFER_DISCOUNT_DURATION) < 0;
639641
}

application/src/ext/java/org/opentripplanner/ext/fares/impl/gtfs/FareLookupService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ private boolean matchesDistance(ScheduledTransitLeg leg, FareLegRule rule) {
285285
var legDistance = leg.directDistanceMeters();
286286

287287
return legDistance > min.toMeters() && legDistance < max.toMeters();
288-
} else return true;
288+
} else {
289+
return true;
290+
}
289291
}
290292

291293
private static Set<FeedScopedId> findAreasWithRules(

0 commit comments

Comments
 (0)