Repository navigation
Move path extraction logic out of Path class - #1730
Conversation
There was a problem hiding this comment.
This is nice. Have so far only skimmed through the code, but this already looks good. I see no objections.
(In another issue it would be nice to remove the encoder dependency like the calcInstructions and calcDetails methods, so that we can work towards a fix of #1551)
|
|
||
| public static Path extractPath(Graph graph, Weighting weighting, SPTEntry fwdEntry, SPTEntry bwdEntry, double weight) { | ||
| return new BidirPathExtractor(graph, weighting).extract(fwdEntry, bwdEntry, weight); | ||
| } |
There was a problem hiding this comment.
If this is the only required public method, can we make the constructor and other methods (package) protected or even private?
There was a problem hiding this comment.
the idea was that one can override stuff like 'onEdge' if need be, but protected works
|
The build error for openjdk13 drives me crazy. There was a mistake regarding the version, but now this is fixed and locally it builds fine with it, even if I do The command should be: Or maybe we try without the caching setting again in .travis.yml ... |
Didn't help. The problem is that it downloads the core dependency: Although it builds this dependency before: |
|
|
||
| script: | ||
| - "mvn -Dkey=$API_KEY clean test verify -B" | ||
| - "mvn -Dkey=$API_KEY clean test verify install -B" |
There was a problem hiding this comment.
this seems to have fixed the build ? should we keep it like this ?
There was a problem hiding this comment.
Yes, the install forces maven to always fetch the dep from local repo. A bit strange as I thought that maven knows this already, but maybe also a bug of that forbiddenapis plugin. A bit strange that it passes for openjdk8...
There was a problem hiding this comment.
Ok, install should be enough (instead of verify install) since install already includes verify, Ill do this in master and then merge this.
There was a problem hiding this comment.
And thanks a lot for figuring this one out!
# Conflicts: # .travis.yml
# Conflicts: # core/files/changelog.txt
* Remove PathBidirRef#switchFromTo * Remove unnecessary statement in edge-based CH algo * Remove unnecessary check in AlternativeRoute * Use dedicated path extraction class for bidir algos * Remove PathBidirRef and subclasses * Make AStar more similar to Dijkstra * Move path extraction for unidir algos into new PathExtractor * Remove extract stuff from Path class
|
Omg, thank you! |
This PR is supposed to move the path extraction stuff out of
Path. So farPathwas used by the routing algorithms to store some intermediate state (SPTEntry,switchToFrom, etc.) that later was used to 'extract' thePath. So basically some parts of the routing algorithm used to live insidePathand (because the extraction depends on the type of algorithm) the subclasses (PathNative,Path4CH,PathBidirRef,EdgeBasedPath4CH). However, sincePathis the return type of theRoutingAlgorithminterface it should really be a data-only class IMO.Here I basically did the following:
Added dedicated classes for path extraction:
PathExtractor,BidirPathExtractor,Node/EdgeBasedCHBidirPathExtractor, which basically take someSPTEntry(or two) and create aPathfrom it. In turn I removed the path extraction stuff fromPathand deleted its subclasses.Instead of holding a reference to an (intermediate)
Pathinstance (bestPath)AbstractBidirAlgonow just has a reference to the best fwd/bwdSPTEntryand thebestWeight. We can overrideextractPathif we want something different than the default path extraction, or just change the path extraction implementation by overridingcreatePathExtractor.