-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve "bogus name" handling when setting StreetEdge's name during postprocessing #6321
Improve "bogus name" handling when setting StreetEdge's name during postprocessing #6321
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6321 +/- ##
=============================================
- Coverage 69.79% 69.78% -0.01%
+ Complexity 17812 17811 -1
=============================================
Files 2020 2020
Lines 76221 76222 +1
Branches 7799 7799
=============================================
Hits 53195 53195
Misses 20312 20312
- Partials 2714 2715 +1 ☔ View full report in Codecov by Sentry. |
a96b885
to
f0dd4f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are a great improvement to comprehension and readability, and could therefore be merged as-is. It is worth considering though whether we should switch to a term other than "bogus" in a follow-up commit.
public void setName(I18NString name) { | ||
this.name = name; | ||
this.flags = BitSetUtils.set(flags, HASBOGUSNAME_FLAG_INDEX, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expression "has bogus name" in the context of an accessor method may imply that a "bogus name" is a thing that may be present or absent, in addition to a "normal name". Seeing these terms in the past I am not sure I realized that "bogusness" was only signalling the provenance of the name, not an extra name. If we want to keep using the term "bogus", is it a better description to say "Name is bogus" instead of "we have a bogus name"?
Taking this a step further, is there a more descriptive term for this than "bogus"? The names are more "inferred", "generic", or "placeholder" than "bogus". Or inverting the boolean condition, "normal" names are those explicitly specified by OSM name tags. Unfortunately "has explicit name from tag" is a little long. NAME_IS_GENERIC or NAME_IS_INFERRED?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fully agree with this but I want to do it in another PR.
I prefer NAME_IS_INFERRED. We can also discuss if the boolean is the right way to model this or if getName
should return a sealed interface to express the two types of names.
I did a bit of code archeology and I believe that this is the commit that introduced "bogus names": c1eedb1 The relevant part is this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the "bogus name" is a poor choice and it would be nice to change it at some point.
But this PR is a good improvement so I think it should be merged.
The PR title is "Mark bogus (generated) edge names in the itinterary" so even the original commit included an alternative clarifying term: "Generated". |
Summary
The method
StreetEdge#setName
is called during post-processing and updates the edge's name. This happens only during the "custom naming" phase where new names are assigned to those which where previous marked as having a "bogus name".A bogus name means that its name is derived from its attributes, so it's "tunnel" or "path".
For this reason I'm changing the code so that the bogus name property is set to false when the name is set.
The final goal is for the mapping from edges to steps to introduce a new step when it encounters such a renamed edge. Currently, this doesn't happen when two edges with "bogus names" are encountered consecutively.
Unit tests
Added.
Documentation
Javadoc around the concept of a bogus name updated.
cc @hbruch @stadtnavimanager