Skip to content

Commit

Permalink
use the monomodal version of turn restrictions in SpeedyGraphBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
tduberne committed Apr 18, 2024
1 parent 280b14e commit d54877f
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand All @@ -31,12 +32,12 @@ public class SpeedyGraphBuilder {

@Deprecated // use build-method with additional mode argument
public static SpeedyGraph build(Network network) {
return build(network, "nothing");
return build(network);
}

public static SpeedyGraph build(Network network, String mode) {
if (hasTurnRestrictions(network)) {
return new SpeedyGraphBuilder().buildWithTurnRestrictions(network, mode);
return new SpeedyGraphBuilder().buildWithTurnRestrictions(network);
}
return new SpeedyGraphBuilder().buildWithoutTurnRestrictions(network);
}
Expand All @@ -50,7 +51,7 @@ private static boolean hasTurnRestrictions(Network network) {
return false;
}

private SpeedyGraph buildWithTurnRestrictions(Network network, String mode) {
private SpeedyGraph buildWithTurnRestrictions(Network network) {
/*
* The implementation follows the algorithm developed by
* Marcel Rieser (Simunto) and Hannes Rewald (Volkswagen Group)
Expand Down Expand Up @@ -85,7 +86,7 @@ private SpeedyGraph buildWithTurnRestrictions(Network network, String mode) {
if (disallowedNextLinks == null) {
continue;
}
List<List<Id<Link>>> turnRestrictions = disallowedNextLinks.getDisallowedLinkSequences(mode);
Collection<List<Id<Link>>> turnRestrictions = disallowedNextLinks.getMergedDisallowedLinkSequences();
if (turnRestrictions == null || turnRestrictions.isEmpty()) {
continue;
}
Expand Down Expand Up @@ -139,15 +140,15 @@ private SpeedyGraph buildWithTurnRestrictions(Network network, String mode) {
return new SpeedyGraph(this.nodeData, this.linkData, this.nodes, this.links);
}

private ColoredLink applyTurnRestriction(TurnRestrictionsContext context, List<List<Id<Link>>> restrictions, Link startingLink) {
private ColoredLink applyTurnRestriction(TurnRestrictionsContext context, Collection<List<Id<Link>>> restrictions, Link startingLink) {
return this.applyTurnRestriction(context, restrictions, startingLink, null);
}

private void applyTurnRestriction(TurnRestrictionsContext context, List<List<Id<Link>>> restrictions, ColoredLink startingLink) {
private void applyTurnRestriction(TurnRestrictionsContext context, Collection<List<Id<Link>>> restrictions, ColoredLink startingLink) {
this.applyTurnRestriction(context, restrictions, null, startingLink);
}

private ColoredLink applyTurnRestriction(TurnRestrictionsContext context, List<List<Id<Link>>> restrictions, Link startingLink, ColoredLink coloredStartingLink) {
private ColoredLink applyTurnRestriction(TurnRestrictionsContext context, Collection<List<Id<Link>>> restrictions, Link startingLink, ColoredLink coloredStartingLink) {
Set<Node> affectedNodes = new HashSet<>();
Set<ColoredNode> affectedColoredNodes = new HashSet<>();
Set<Link> affectedLinks = new HashSet<>();
Expand Down

0 comments on commit d54877f

Please sign in to comment.