diff --git a/core/src/main/java/com/graphhopper/reader/ReaderElement.java b/core/src/main/java/com/graphhopper/reader/ReaderElement.java index d94b27c3e2e..7b59503cf1f 100644 --- a/core/src/main/java/com/graphhopper/reader/ReaderElement.java +++ b/core/src/main/java/com/graphhopper/reader/ReaderElement.java @@ -103,6 +103,19 @@ public String getTag(String name) { return (String) properties.get(name); } + // ORS-GH MOD START - account for enumerations of multiple values + public String [] getTagValues(String name) { + String tagValue = getTag(name); + if (tagValue==null) + return new String[0]; + + String [] tagValues = {tagValue}; + if (tagValue.contains(";")) + tagValues = tagValue.split(";"); + return tagValues; + } + // ORS-GH MOD END + @SuppressWarnings("unchecked") public T getTag(String key, T defaultValue) { T val = (T) properties.get(key); @@ -146,7 +159,14 @@ public boolean hasTag(String key, String... values) { * Check that a given tag has one of the specified values. */ public final boolean hasTag(String key, Set values) { - return values.contains(getTag(key, "")); + // ORS-GH MOD START - account for enumerations of multiple values + String [] tagValues = getTagValues(key); + for (String tagValue: tagValues) { + if (values.contains(tagValue)) + return true; + } + return false; + // ORS-GH MOD END } /** @@ -155,7 +175,10 @@ public final boolean hasTag(String key, Set values) { */ public boolean hasTag(List keyList, Set values) { for (String key : keyList) { - if (values.contains(getTag(key, ""))) + // ORS-GH MOD START + //if (values.contains(getTag(key, ""))) + if (hasTag(key, values)) + // ORS-GH MOD END return true; } return false; @@ -172,6 +195,17 @@ public String getFirstPriorityTag(List restrictions) { return ""; } + // ORS-GH MOD START - account for enumerations of multiple values + public String [] getFirstPriorityTagValues(List restrictions) { + String [] empty = {}; + for (String str : restrictions) { + if (hasTag(str)) + return getTagValues(str); + } + return empty; + } + // ORS-GH MOD END + public void removeTag(String name) { properties.remove(name); }