Skip to content

Reduce usages of fwd/bwd flags in DefaultEdgeFilter constructor - #1381

Merged
karussell merged 4 commits into
graphhopper:masterfrom
easbar:default_edge_filter_refactoring
May 28, 2018
Merged

karussell merged 4 commits into
graphhopper:masterfrom
easbar:default_edge_filter_refactoring

Conversation

@easbar

@easbar easbar commented May 27, 2018

Copy link
Copy Markdown
Member

#1380

Replacing the constructor calls in other branches can be done quite easily using this regex search&replace in IntelliJ:
replace

@easbar

easbar commented May 27, 2018

Copy link
Copy Markdown
Member Author

Should we replace the default constructor calls with DefaultEdgeFilter.allEdges as well ? Maybe there should be a better name for it to distinguish it from EdgeFilter.ALL_EDGES ?

@@ -40,6 +40,18 @@ public DefaultEdgeFilter(FlagEncoder encoder, boolean bwd, boolean fwd) {
this.fwd = fwd;
}

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.

Should we remove this or even all constructors? IMO the order bwd+fwd is unintuitive

@easbar easbar May 27, 2018 •

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.

I removed the constructor that only takes a FlagEncoder and made the other one protected. We could make it private, too and instead add a getter for the flag encoder (this is currently needed for the PrepEdgeFilter in PrepareRoutingSubnetworks).

@easbar easbar May 27, 2018 •

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.

Changed the order bwd+fwd too.

@karussell

Copy link
Copy Markdown
Member

Should we replace the default constructor calls with DefaultEdgeFilter.allEdges as well ?

IMO yes, so we have no mixed constructor+factory usage. At least the bwd+fwd constructor

Maybe there should be a better name for it to distinguish it from EdgeFilter.ALL_EDGES ?

IMO this is fine - or maybe add a javadoc comment what it does?

@karussell karussell added this to the 0.11 milestone May 27, 2018
@karussell
karussell merged commit 8e367e7 into graphhopper:master May 28, 2018
@easbar
easbar deleted the default_edge_filter_refactoring branch May 28, 2018 21:12
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