diff --git a/core/src/main/java/com/graphhopper/routing/util/parsers/BikeCommonPriorityParser.java b/core/src/main/java/com/graphhopper/routing/util/parsers/BikeCommonPriorityParser.java index 0ead9345b63..019593770a7 100644 --- a/core/src/main/java/com/graphhopper/routing/util/parsers/BikeCommonPriorityParser.java +++ b/core/src/main/java/com/graphhopper/routing/util/parsers/BikeCommonPriorityParser.java @@ -36,7 +36,7 @@ public abstract class BikeCommonPriorityParser implements TagParser { int avoidSpeedLimit; EnumEncodedValue bikeRouteEnc; Map routeMap = new HashMap<>(); - protected final Set goodSurface = new HashSet<>(List.of("paved", "asphalt", "concrete")); + protected final Set goodSurface = Set.of("paved", "asphalt", "concrete"); // This is the specific bicycle class private String classBicycleKey; @@ -154,11 +154,9 @@ private PriorityCode convertClassValueToPriority(String tagvalue) { */ void collect(ReaderWay way, double wayTypeSpeed, TreeMap weightToPrioMap) { String highway = way.getTag("highway"); - boolean isTracTypeGrade1 = way.getTag("tracktype", "").equals("grade1"); - boolean isGoodSurface = goodSurface.contains(way.getTag("surface","")); if (isDesignated(way)) { - if ("path".equals(highway) || - ("track".equals(highway) && (isTracTypeGrade1 || isGoodSurface ))) + boolean isGoodSurface = way.getTag("tracktype", "").equals("grade1") || goodSurface.contains(way.getTag("surface","")); + if ("path".equals(highway) || "track".equals(highway) && isGoodSurface) weightToPrioMap.put(100d, VERY_NICE); else weightToPrioMap.put(100d, PREFER); diff --git a/core/src/main/java/com/graphhopper/routing/util/parsers/MountainBikePriorityParser.java b/core/src/main/java/com/graphhopper/routing/util/parsers/MountainBikePriorityParser.java index bdbc77cd69e..148406bf7e1 100644 --- a/core/src/main/java/com/graphhopper/routing/util/parsers/MountainBikePriorityParser.java +++ b/core/src/main/java/com/graphhopper/routing/util/parsers/MountainBikePriorityParser.java @@ -45,8 +45,7 @@ void collect(ReaderWay way, double wayTypeSpeed, TreeMap w String highway = way.getTag("highway"); if ("track".equals(highway)) { String trackType = way.getTag("tracktype"); - boolean isGoodSurface = goodSurface.contains(way.getTag("surface","")); - if ("grade1".equals(trackType) || isGoodSurface) + if ("grade1".equals(trackType) || goodSurface.contains(way.getTag("surface",""))) weightToPrioMap.put(50d, SLIGHT_PREFER); else if (trackType == null) weightToPrioMap.put(90d, PREFER); diff --git a/core/src/main/java/com/graphhopper/routing/util/parsers/RacingBikePriorityParser.java b/core/src/main/java/com/graphhopper/routing/util/parsers/RacingBikePriorityParser.java index 8a46bae141f..c3e3b64df75 100644 --- a/core/src/main/java/com/graphhopper/routing/util/parsers/RacingBikePriorityParser.java +++ b/core/src/main/java/com/graphhopper/routing/util/parsers/RacingBikePriorityParser.java @@ -55,9 +55,8 @@ void collect(ReaderWay way, double wayTypeSpeed, TreeMap w if ("service".equals(highway) || "residential".equals(highway)) { weightToPrioMap.put(40d, SLIGHT_AVOID); } else if ("track".equals(highway)) { - boolean isGoodSurface = goodSurface.contains(way.getTag("surface","")); String trackType = way.getTag("tracktype"); - if ("grade1".equals(trackType) || isGoodSurface ) + if ("grade1".equals(trackType) || goodSurface.contains(way.getTag("surface",""))) weightToPrioMap.put(110d, VERY_NICE); else if (trackType == null || trackType.startsWith("grade")) weightToPrioMap.put(110d, AVOID_MORE);