Skip to content

Remove TagParser#createEncodedValues - #2559

Merged
easbar merged 3 commits into
masterfrom
separate_ev_creation_from_parsing2
Apr 14, 2022
Merged

easbar merged 3 commits into
masterfrom
separate_ev_creation_from_parsing2

Conversation

@easbar

@easbar easbar commented Apr 14, 2022

Copy link
Copy Markdown
Member

With this PR encoded values are no longer created inside tag parsers. The tag parsers receive the encoded values they are working with via their constructors instead. The GraphHopper class now creates encoded values via the EncodedValueFactory (in every case, not just when calling load() without init()...). Next thing to do will be removing AbstractFlagEncoder#createEncodedValues as well.

Related: #2463,#2551

@karussell karussell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks LGTM!

}
if (!em.hasEncodedValue("bike_access")) {
em.addEncodedValue(new SimpleBooleanEncodedValue("bike_access", true), false);
_addEdgeTagParser(new DefaultTagParserFactory().create(em, "bike_access"));

@karussell karussell Apr 14, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above you created the parsers (OSMRoadEnvironmentParser etc) without the factory. Should this be more consistent? We could e.g. create the TagParserFactory once and then use it everywhere.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, actually we always create the parsers except for these two new ones (car_access and bike_access). I removed the usages of the DefaultTagParserFactory for these two cases for now. TagParserManager will be removed or transformed into something different soon anyway. Then I will check if we can use the factory consistently everywhere or something.

@easbar

easbar commented Apr 14, 2022

Copy link
Copy Markdown
Member Author

Thanks for taking a look!

@easbar
easbar merged commit 7a50a69 into master Apr 14, 2022
@easbar
easbar deleted the separate_ev_creation_from_parsing2 branch April 14, 2022 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants