diff --git a/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java index c5c59e4dc37..8767abe7478 100644 --- a/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java +++ b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/WalkStepMapper.java @@ -42,7 +42,7 @@ public ApiWalkStep mapWalkStep(WalkStep domain) { api.exit = domain.getExit(); api.stayOn = domain.isStayOn(); api.area = domain.getArea(); - api.bogusName = domain.getBogusName(); + api.bogusName = domain.nameIsDerived(); if (domain.getStartLocation() != null) { api.lon = domain.getStartLocation().longitude(); api.lat = domain.getStartLocation().latitude(); diff --git a/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stepImpl.java b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stepImpl.java index 6bd51ae5f29..f14db6f213f 100644 --- a/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stepImpl.java +++ b/application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/stepImpl.java @@ -35,7 +35,7 @@ public DataFetcher area() { @Override public DataFetcher bogusName() { - return environment -> getSource(environment).getBogusName(); + return environment -> getSource(environment).nameIsDerived(); } @Override diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PathGuidanceType.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PathGuidanceType.java index c52baa0be4c..68406f57d54 100644 --- a/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PathGuidanceType.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PathGuidanceType.java @@ -96,7 +96,7 @@ public static GraphQLObjectType create(GraphQLObjectType elevationStepType) { "The name of this street was generated by the system, so we should only display it once, and generally just display right/left directions" ) .type(Scalars.GraphQLBoolean) - .dataFetcher(environment -> ((WalkStep) environment.getSource()).getBogusName()) + .dataFetcher(environment -> ((WalkStep) environment.getSource()).nameIsDerived()) .build() ) .field( diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java index e05bc736cbb..42bd57ca13c 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/osm/naming/PortlandCustomNamer.java @@ -76,7 +76,7 @@ public void recordEdges(OsmWithTags way, StreetEdgePair edgePair) { edgePair .asIterable() .forEach(edge -> { - if (!edge.hasBogusName()) { + if (!edge.nameIsDerived()) { return; // this edge already has a real name so there is nothing to do } if (isHighwayLink) { @@ -149,7 +149,7 @@ private static String nameAccordingToDestination(StreetEdge e, int maxDepth) { return null; } for (StreetEdge out : e.getToVertex().getOutgoingStreetEdges()) { - if (out.hasBogusName()) { + if (out.nameIsDerived()) { String name = nameAccordingToDestination(out, maxDepth - 1); if (name == null) { continue; @@ -170,7 +170,7 @@ private static String nameAccordingToOrigin(StreetEdge e, int maxDepth) { return null; } for (StreetEdge in : e.getFromVertex().getIncomingStreetEdges()) { - if (in.hasBogusName()) { + if (in.nameIsDerived()) { String name = nameAccordingToOrigin(in, maxDepth - 1); if (name == null) { continue; diff --git a/application/src/main/java/org/opentripplanner/inspector/raster/PathwayEdgeRenderer.java b/application/src/main/java/org/opentripplanner/inspector/raster/PathwayEdgeRenderer.java index 0da19670264..27328b1ba1f 100644 --- a/application/src/main/java/org/opentripplanner/inspector/raster/PathwayEdgeRenderer.java +++ b/application/src/main/java/org/opentripplanner/inspector/raster/PathwayEdgeRenderer.java @@ -22,7 +22,7 @@ public Optional renderEdge(Edge e) { StringBuilder sb = new StringBuilder(); - if (!pwe.hasBogusName()) { + if (!pwe.nameIsDerived()) { sb.append("name=").append(pwe.getName()).append(", "); } diff --git a/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java b/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java index 83b677a62ce..1363ba7e6be 100644 --- a/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java +++ b/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java @@ -38,7 +38,7 @@ private static List mapStreetEdge(StreetEdge se) { kv("noThruTraffic", noThruTrafficAsString(se)), kv("wheelchairAccessible", se.isWheelchairAccessible()) ); - if (se.hasBogusName()) { + if (se.nameIsDerived()) { props.addFirst(kv("name", "%s (generated)".formatted(se.getName().toString()))); } else { props.addFirst(kv("name", se.getName().toString())); diff --git a/application/src/main/java/org/opentripplanner/model/plan/WalkStep.java b/application/src/main/java/org/opentripplanner/model/plan/WalkStep.java index 45f2b5da701..c2c2b2c609e 100644 --- a/application/src/main/java/org/opentripplanner/model/plan/WalkStep.java +++ b/application/src/main/java/org/opentripplanner/model/plan/WalkStep.java @@ -39,7 +39,7 @@ public final class WalkStep { private final Set streetNotes; private final boolean area; - private final boolean bogusName; + private final boolean nameIsDerived; private final double angle; private final boolean walkingBike; @@ -57,7 +57,7 @@ public final class WalkStep { Set streetNotes, String exit, ElevationProfile elevationProfile, - boolean bogusName, + boolean nameIsDerived, boolean walkingBike, boolean area, boolean stayOn, @@ -71,7 +71,7 @@ public final class WalkStep { this.directionText = directionText; this.streetNotes = Set.copyOf(Objects.requireNonNull(streetNotes)); this.startLocation = Objects.requireNonNull(startLocation); - this.bogusName = bogusName; + this.nameIsDerived = nameIsDerived; this.angle = DoubleUtils.roundTo2Decimals(angle); this.walkingBike = walkingBike; this.area = area; @@ -148,9 +148,10 @@ public boolean getArea() { /** * The name of this street was generated by the system, so we should only display it once, and * generally just display right/left directions + * @see Edge#nameIsDerived() */ - public boolean getBogusName() { - return bogusName; + public boolean nameIsDerived() { + return nameIsDerived; } /** diff --git a/application/src/main/java/org/opentripplanner/model/plan/WalkStepBuilder.java b/application/src/main/java/org/opentripplanner/model/plan/WalkStepBuilder.java index 8d4df6634fd..b2f9e1f7510 100644 --- a/application/src/main/java/org/opentripplanner/model/plan/WalkStepBuilder.java +++ b/application/src/main/java/org/opentripplanner/model/plan/WalkStepBuilder.java @@ -17,7 +17,7 @@ public class WalkStepBuilder { private final Set streetNotes = new HashSet<>(); private I18NString directionText; private WgsCoordinate startLocation; - private boolean bogusName = false; + private boolean nameIsDerived = false; private double angle; private boolean walkingBike = false; private boolean area = false; @@ -44,8 +44,8 @@ public WalkStepBuilder withStartLocation(WgsCoordinate startLocation) { return this; } - public WalkStepBuilder withBogusName(boolean bogusName) { - this.bogusName = bogusName; + public WalkStepBuilder withNameIsDerived(boolean nameIsDerived) { + this.nameIsDerived = nameIsDerived; return this; } @@ -140,8 +140,11 @@ public I18NString directionText() { return directionText; } - public boolean bogusName() { - return bogusName; + /** + * @see Edge#nameIsDerived() + */ + public boolean nameIsDerived() { + return nameIsDerived; } public RelativeDirection relativeDirection() { @@ -157,7 +160,7 @@ public WalkStep build() { streetNotes, exit, elevationProfile, - bogusName, + nameIsDerived, walkingBike, area, stayOn, diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java index 32f5ccf533b..4ce1c616e65 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/StatesToWalkStepsMapper.java @@ -430,7 +430,7 @@ private boolean continueOnSameStreet(Edge edge, String streetNameNoParens) { return !( current.directionText().toString() != null && !(java.util.Objects.equals(current.directionTextNoParens(), streetNameNoParens)) && - (!current.bogusName() || !edge.hasBogusName()) + (!current.nameIsDerived() || !edge.nameIsDerived()) ); } @@ -525,7 +525,7 @@ private void createAndSaveStep( addStep( createWalkStep(forwardState, backState) .withDirectionText(name) - .withBogusName(false) + .withNameIsDerived(false) .withDirections(lastAngle, DirectionUtils.getFirstAngle(edge.getGeometry()), false) .withRelativeDirection(direction) .addDistance(edge.getDistanceMeters()) @@ -543,7 +543,7 @@ private WalkStepBuilder createWalkStep(State forwardState, State backState) { .builder() .withDirectionText(en.getName()) .withStartLocation(new WgsCoordinate(backState.getVertex().getCoordinate())) - .withBogusName(en.hasBogusName()) + .withNameIsDerived(en.nameIsDerived()) .withAngle(DirectionUtils.getFirstAngle(forwardState.getBackEdge().getGeometry())) .withWalkingBike(forwardState.isBackWalkingBike()) .withArea(forwardState.getBackEdge() instanceof AreaEdge) diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/Edge.java b/application/src/main/java/org/opentripplanner/street/model/edge/Edge.java index 8e4126b4e59..b24dbb2e36e 100644 --- a/application/src/main/java/org/opentripplanner/street/model/edge/Edge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/Edge.java @@ -152,7 +152,7 @@ public String getDefaultName() { * Returns false if the field reflects the real world name, like "Fifth Avenue", * "Hauptstraße" or "Øvre Holmegate". */ - public boolean hasBogusName() { + public boolean nameIsDerived() { return false; } diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java index ca3b0b4b0f7..8fa88009b73 100644 --- a/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorAlightEdge.java @@ -76,7 +76,7 @@ public I18NString getName() { * @author mattwigway */ @Override - public boolean hasBogusName() { + public boolean nameIsDerived() { return false; } diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java index 9bf0d67afa5..cacc97fc2f1 100644 --- a/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/ElevatorBoardEdge.java @@ -65,7 +65,7 @@ public I18NString getName() { * never included in plans. */ @Override - public boolean hasBogusName() { + public boolean nameIsDerived() { return true; } diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java index 703658fdda4..cfa82ba85b5 100644 --- a/application/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/PathwayEdge.java @@ -167,7 +167,7 @@ public I18NString getName() { } @Override - public boolean hasBogusName() { + public boolean nameIsDerived() { return signpostedAs == null; } diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java index 468da359e0a..02675b1202c 100644 --- a/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdge.java @@ -55,7 +55,10 @@ public class StreetEdge /** If you have more than 16 flags, increase flags to short or int */ static final int BACK_FLAG_INDEX = 0; static final int ROUNDABOUT_FLAG_INDEX = 1; - static final int HASBOGUSNAME_FLAG_INDEX = 2; + /** + * @see Edge#nameIsDerived() + */ + static final int NAME_IS_DERIVED_FLAG_INDEX = 2; static final int MOTOR_VEHICLE_NOTHRUTRAFFIC = 3; static final int STAIRS_FLAG_INDEX = 4; static final int SLOPEOVERRIDE_FLAG_INDEX = 5; @@ -444,20 +447,22 @@ public I18NString getName() { } /** - * Update the name of the edge after it has been constructed. This method also sets the bogusName + * Update the name of the edge after it has been constructed. This method also sets the nameIsDerived * property to false, indicating to the code that maps from edges to steps that this is a real * street name. - * @see Edge#hasBogusName() + * @see Edge#nameIsDerived() */ public void setName(I18NString name) { this.name = name; - this.flags = BitSetUtils.set(flags, HASBOGUSNAME_FLAG_INDEX, false); + this.flags = BitSetUtils.set(flags, NAME_IS_DERIVED_FLAG_INDEX, false); } - public boolean hasBogusName() { - return BitSetUtils.get(flags, HASBOGUSNAME_FLAG_INDEX); + @Override + public boolean nameIsDerived() { + return BitSetUtils.get(flags, NAME_IS_DERIVED_FLAG_INDEX); } + @Override public LineString getGeometry() { return CompactLineStringUtils.uncompactLineString( fromv.getLon(), diff --git a/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeBuilder.java b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeBuilder.java index 99a02205eb6..aa168b1453d 100644 --- a/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeBuilder.java +++ b/application/src/main/java/org/opentripplanner/street/model/edge/StreetEdgeBuilder.java @@ -3,8 +3,8 @@ import static org.opentripplanner.street.model.edge.StreetEdge.BACK_FLAG_INDEX; import static org.opentripplanner.street.model.edge.StreetEdge.BICYCLE_NOTHRUTRAFFIC; import static org.opentripplanner.street.model.edge.StreetEdge.CLASS_LINK; -import static org.opentripplanner.street.model.edge.StreetEdge.HASBOGUSNAME_FLAG_INDEX; import static org.opentripplanner.street.model.edge.StreetEdge.MOTOR_VEHICLE_NOTHRUTRAFFIC; +import static org.opentripplanner.street.model.edge.StreetEdge.NAME_IS_DERIVED_FLAG_INDEX; import static org.opentripplanner.street.model.edge.StreetEdge.ROUNDABOUT_FLAG_INDEX; import static org.opentripplanner.street.model.edge.StreetEdge.SLOPEOVERRIDE_FLAG_INDEX; import static org.opentripplanner.street.model.edge.StreetEdge.STAIRS_FLAG_INDEX; @@ -175,7 +175,7 @@ public B withLink(boolean link) { } public B withBogusName(boolean hasBogusName) { - flags = BitSetUtils.set(flags, HASBOGUSNAME_FLAG_INDEX, hasBogusName); + flags = BitSetUtils.set(flags, NAME_IS_DERIVED_FLAG_INDEX, hasBogusName); return instance(); } diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java index cbfb7b76c6f..851a71620bf 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/naming/SidewalkNamerTest.java @@ -58,7 +58,7 @@ void postprocess() { assertNotEquals(sidewalk.edge.getName(), pryorStreet.edge.getName()); builder.postProcess(new SidewalkNamer()); assertEquals(sidewalk.edge.getName(), pryorStreet.edge.getName()); - assertFalse(sidewalk.edge.hasBogusName()); + assertFalse(sidewalk.edge.nameIsDerived()); } private static class ModelBuilder { diff --git a/application/src/test/java/org/opentripplanner/model/plan/WalkStepTest.java b/application/src/test/java/org/opentripplanner/model/plan/WalkStepTest.java index 7199c7bea60..4556cb90de0 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/WalkStepTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/WalkStepTest.java @@ -17,7 +17,7 @@ public void testRelativeDirection() { WalkStepBuilder builder = new WalkStepBuilder() .withDirectionText(new NonLocalizedString("Any")) .withStartLocation(new WgsCoordinate(3.0, 4.0)) - .withBogusName(false) + .withNameIsDerived(false) .withAngle(0.0) .withWalkingBike(false) .withArea(false); diff --git a/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeBuilderTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeBuilderTest.java index d447916d21d..aeddb9221c9 100644 --- a/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeBuilderTest.java @@ -32,7 +32,7 @@ class StreetEdgeBuilderTest { private static final float WALK_SAFETY_FACTOR = 0.5f; private static final float BICYCLE_SAFETY_FACTOR = 0.4f; private static final boolean SLOPE_OVERRIDE = false; - private static final boolean BOGUS_NAME = true; + private static final boolean NAME_IS_DERIVED = true; private static final boolean BICYCLE_NO_THRU_TRAFFIC = true; private static final boolean MOTOR_VEHICLE_NO_THRU_TRAFFIC = true; private static final boolean WALK_NO_THRU_TRAFFIC = true; @@ -82,7 +82,7 @@ private static StreetEdge buildStreetEdge() { .withBack(BACK) .withStairs(STAIRS) .withSlopeOverride(SLOPE_OVERRIDE) - .withBogusName(BOGUS_NAME) + .withBogusName(NAME_IS_DERIVED) .withWalkNoThruTraffic(WALK_NO_THRU_TRAFFIC) .withBicycleNoThruTraffic(BICYCLE_NO_THRU_TRAFFIC) .withMotorVehicleNoThruTraffic(MOTOR_VEHICLE_NO_THRU_TRAFFIC) @@ -100,7 +100,7 @@ private static void assertAllProperties(StreetEdge streetEdge) { assertEquals(WALK_SAFETY_FACTOR, streetEdge.getWalkSafetyFactor()); assertEquals(BICYCLE_SAFETY_FACTOR, streetEdge.getBicycleSafetyFactor()); assertEquals(SLOPE_OVERRIDE, streetEdge.isSlopeOverride()); - assertEquals(BOGUS_NAME, streetEdge.hasBogusName()); + assertEquals(NAME_IS_DERIVED, streetEdge.nameIsDerived()); assertEquals(WALK_NO_THRU_TRAFFIC, streetEdge.isWalkNoThruTraffic()); assertEquals(BICYCLE_NO_THRU_TRAFFIC, streetEdge.isBicycleNoThruTraffic()); assertEquals(MOTOR_VEHICLE_NO_THRU_TRAFFIC, streetEdge.isMotorVehicleNoThruTraffic()); diff --git a/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java index ef2bacb91dd..bbc77656a23 100644 --- a/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java +++ b/application/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java @@ -413,11 +413,11 @@ void setName() { .buildAndConnect(); assertEquals(path, edge.getName()); - assertTrue(edge.hasBogusName()); + assertTrue(edge.nameIsDerived()); var mainStreet = I18NString.of("Main Street"); edge.setName(mainStreet); assertEquals(mainStreet, edge.getName()); - assertFalse(edge.hasBogusName()); + assertFalse(edge.nameIsDerived()); } }