Repository navigation
Replace EncodingManager with TagParserManager where it is needed - #2541
Merged
Merged
Conversation
* this way we can soon use TagParserManager in GraphHopperStorage (and in turn simplify EncodingManager)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is based on #2540.
EncodingManagerdoes (too) many things. One thing it does is dealing with the different parsers used for the OSM import. However, we use it in very many places where we are not dealing with parsing OSM at all. Here I have created a 1:1 copy ofEncodingManager, calledTagParserManagerand replaced usages ofEncodingManagerwith this newTagParserManagerclass wherever we actually use the parsers. In turn, we can remove the parsing stuff fromEncodingManager, because it is not needed in all the other places. Now there are around 120 usages ofTagParserManagerund 540 usages ofEncodingManagerwhich means that we can effectively remove parsing related code in many places.The
TagParserManageris often created via theGraphHopperclass, just like we created theEncodingManagerthere before. To be able to transition from this higher level code to the lower level API that uses only theEncodingManagerthere isTagParserManager#getEncodingManager.From here on (not this PR, but soon after) we still need to keep cleaning up
EncodingManager. Eventually, it should just be a combination of theencodedValuesMapandedge/turnCostConfig, so we will have to focus on removing theedgeEncoderslist and theturnCostParsersmap. One very common usage pattern is this:I think at some point this should (at least in principle) be turned into something like this to get rid of the flag encoders list for example:
We will also need to get rid of
Weighting#getFlagEncoder()for this to work.One possible shortcut I see that we could use to keep focus on removing FlagEncoders in our import code first, without having to deal with changes to all the
FastestWeightingusages etc. at the same time, would be something like this:For this the next step would be turning the
List<AbstractFlagEncoder>inEncodingManagerintoList<FlagEncoder>.