Fix some new errorprone warnings

Mostly javadoc related, but one (useless) method was entirely removed.

Signed-off-by: Taylor Smock <taylor.smock@kaart.com>
pull/1/head
Taylor Smock 2020-06-10 17:03:21 -06:00
rodzic cde1e3f60a
commit f6f3d256d7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
4 zmienionych plików z 160 dodań i 148 usunięć

Wyświetl plik

@ -75,7 +75,7 @@ public class DataAvailability {
jsonFile.setMaxAge(SEVEN_DAYS_IN_SECONDS); jsonFile.setMaxAge(SEVEN_DAYS_IN_SECONDS);
jsonParser.next(); jsonParser.next();
JsonObject jsonObject = jsonParser.getObject(); JsonObject jsonObject = jsonParser.getObject();
for (Entry<String, JsonValue> entry : jsonObject.entrySet()) { for (Map.Entry<String, JsonValue> entry : jsonObject.entrySet()) {
Logging.debug("{0}: {1}", entry.getKey(), entry.getValue()); Logging.debug("{0}: {1}", entry.getKey(), entry.getValue());
if (JsonValue.ValueType.OBJECT == entry.getValue().getValueType() if (JsonValue.ValueType.OBJECT == entry.getValue().getValueType()
&& entry.getValue().asJsonObject().containsKey("countries")) { && entry.getValue().asJsonObject().containsKey("countries")) {
@ -156,6 +156,8 @@ public class DataAvailability {
} }
/** /**
* Get the global i nstance that should be used to check for data availability
*
* @return the unique instance * @return the unique instance
*/ */
public static DataAvailability getInstance() { public static DataAvailability getInstance() {
@ -167,6 +169,8 @@ public class DataAvailability {
} }
/** /**
* Check if a bbox may have data
*
* @param bbox An area that may have data * @param bbox An area that may have data
* @return True if one of the corners of the {@code bbox} is in a country with * @return True if one of the corners of the {@code bbox} is in a country with
* available data. * available data.
@ -177,10 +181,13 @@ public class DataAvailability {
corners.add(new LatLon(bbox.getBottomRightLat(), bbox.getTopLeftLon())); corners.add(new LatLon(bbox.getBottomRightLat(), bbox.getTopLeftLon()));
corners.add(bbox.getTopLeft()); corners.add(bbox.getTopLeft());
corners.add(new LatLon(bbox.getTopLeftLat(), bbox.getBottomRightLon())); corners.add(new LatLon(bbox.getTopLeftLat(), bbox.getBottomRightLon()));
corners.add(bbox.getCenter());
return corners.parallelStream().anyMatch(this::hasData); return corners.parallelStream().anyMatch(this::hasData);
} }
/** /**
* Check if a latlon point may have data
*
* @param latLon A point that may have data from MapWithAI * @param latLon A point that may have data from MapWithAI
* @return true if it is in an ares with data from MapWithAI * @return true if it is in an ares with data from MapWithAI
*/ */
@ -274,7 +281,7 @@ public class DataAvailability {
} }
/** /**
* Set the URL to use to get MapWithAI information * Set the URL to use to get MapWithAI information (`sources.json`)
* *
* @param url The URL which serves MapWithAI servers * @param url The URL which serves MapWithAI servers
*/ */
@ -283,7 +290,9 @@ public class DataAvailability {
} }
/** /**
* @param url The URL which serves MapWithAI servers * Get the URL for the `sources.json`.
*
* @return The URL which serves MapWithAI servers
*/ */
public static String getReleaseUrl() { public static String getReleaseUrl() {
return defaultServerUrl; return defaultServerUrl;

Wyświetl plik

@ -66,6 +66,8 @@ public final class MapWithAIPreferenceHelper {
} }
/** /**
* Check if the user wants to merge buildings and addresses
*
* @return {@code true} if we want to automatically merge buildings with * @return {@code true} if we want to automatically merge buildings with
* pre-existing addresses * pre-existing addresses
*/ */
@ -74,6 +76,8 @@ public final class MapWithAIPreferenceHelper {
} }
/** /**
* Check if the user wants to switch layers automatically after adding data.
*
* @return {@code true} if we want to automatically switch layers * @return {@code true} if we want to automatically switch layers
*/ */
public static boolean isSwitchLayers() { public static boolean isSwitchLayers() {
@ -85,6 +89,13 @@ public final class MapWithAIPreferenceHelper {
return returnBoolean; return returnBoolean;
} }
/**
* Add a MapWithAI url. If both boolean parameters are false, nothing happens.
*
* @param info The info to add
* @param enabled If it should be enabled
* @param permanent If it should be added permanently
*/
public static void setMapWithAIUrl(MapWithAIInfo info, boolean enabled, boolean permanent) { public static void setMapWithAIUrl(MapWithAIInfo info, boolean enabled, boolean permanent) {
if (permanent && enabled) { if (permanent && enabled) {
MapWithAILayerInfo.instance.add(info); MapWithAILayerInfo.instance.add(info);
@ -162,6 +173,8 @@ public final class MapWithAIPreferenceHelper {
} }
/** /**
* Get the tags to replace
*
* @return A map of tags to replacement tags (use {@link Tag#ofString} to parse) * @return A map of tags to replacement tags (use {@link Tag#ofString} to parse)
*/ */
public static Map<String, String> getReplacementTags() { public static Map<String, String> getReplacementTags() {
@ -172,6 +185,8 @@ public final class MapWithAIPreferenceHelper {
} }
/** /**
* Set the tags to replace
*
* @param tagsToReplace set the tags to replace * @param tagsToReplace set the tags to replace
*/ */
public static void setReplacementTags(Map<String, String> tagsToReplace) { public static void setReplacementTags(Map<String, String> tagsToReplace) {

Wyświetl plik

@ -25,7 +25,6 @@ import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryBounds;
import org.openstreetmap.josm.data.imagery.Shape; import org.openstreetmap.josm.data.imagery.Shape;
import org.openstreetmap.josm.data.sources.SourceInfo; import org.openstreetmap.josm.data.sources.SourceInfo;
import org.openstreetmap.josm.data.sources.SourcePreferenceEntry; import org.openstreetmap.josm.data.sources.SourcePreferenceEntry;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo.MapWithAIPreferenceEntry;
import org.openstreetmap.josm.spi.preferences.Config; import org.openstreetmap.josm.spi.preferences.Config;
import org.openstreetmap.josm.tools.CheckParameterUtil; import org.openstreetmap.josm.tools.CheckParameterUtil;
import org.openstreetmap.josm.tools.Logging; import org.openstreetmap.josm.tools.Logging;
@ -43,11 +42,12 @@ public class MapWithAIInfo extends
/** /**
* when adding a field, also adapt the: {@link #MapWithAIPreferenceEntry * when adding a field, also adapt the: {@link #MapWithAIPreferenceEntry
* MapWithAIPreferenceEntry object} * MapWithAIPreferenceEntry object}
* {@link #MapWithAIPreferenceEntry#MapWithAIPreferenceEntry(MapWithAIInfo) * {@link MapWithAIPreferenceEntry#MapWithAIPreferenceEntry(MapWithAIInfo)
* MapWithAIPreferenceEntry constructor} * MapWithAIPreferenceEntry constructor}
* {@link #MapWithAIInfo(MapWithAIPreferenceEntry) ImageryInfo constructor} * {@link MapWithAIInfo#MapWithAIInfo(MapWithAIPreferenceEntry) ImageryInfo
* {@link #MapWithAIInfo(ImageryInfo) MapWithAIInfo constructor} * constructor} {@link MapWithAIInfo#MapWithAIInfo(ImageryInfo) MapWithAIInfo
* {@link #equalsPref(MapWithAIPreferenceEntry) equalsPref method} * constructor} {@link MapWithAIInfo#equalsPref(MapWithAIPreferenceEntry)
* equalsPref method}
**/ **/
public static class MapWithAIPreferenceEntry extends SourcePreferenceEntry<MapWithAIInfo> { public static class MapWithAIPreferenceEntry extends SourcePreferenceEntry<MapWithAIInfo> {
@StructEntry @StructEntry
@ -64,7 +64,7 @@ public class MapWithAIInfo extends
String categories; String categories;
/** /**
* Constructs a new empty {@MapWithAIPreferenceEntry} * Constructs a new empty {@link MapWithAIPreferenceEntry}
*/ */
public MapWithAIPreferenceEntry() { public MapWithAIPreferenceEntry() {
// Do nothing // Do nothing
@ -369,13 +369,19 @@ public class MapWithAIInfo extends
} }
/** /**
* @return The required replacement tags (run first) * Get the requested tags to replace. These should be run before user requested
* replacements.
*
* @return The required replacement tags
*/ */
public Map<String, String> getReplacementTags() { public Map<String, String> getReplacementTags() {
return replacementTags; return replacementTags;
} }
/** /**
* Set whether or not we should perform conflation using the specified
* conflation URL
*
* @param conflation If true, try to use the conflation URL * @param conflation If true, try to use the conflation URL
*/ */
public void setConflation(boolean conflation) { public void setConflation(boolean conflation) {
@ -383,6 +389,8 @@ public class MapWithAIInfo extends
} }
/** /**
* Set the URL to use for conflation purposes.
*
* @param conflationUrl Set the conflation url to use. null will disable, but * @param conflationUrl Set the conflation url to use. null will disable, but
* you should use {@link MapWithAIInfo#setConflation}. * you should use {@link MapWithAIInfo#setConflation}.
*/ */
@ -391,6 +399,8 @@ public class MapWithAIInfo extends
} }
/** /**
* Set any parameters that are required/useful for the conflation URL
*
* @param parameters Set the conflation parameters * @param parameters Set the conflation parameters
*/ */
public void setConflationParameters(JsonArray parameters) { public void setConflationParameters(JsonArray parameters) {
@ -407,6 +417,9 @@ public class MapWithAIInfo extends
} }
/** /**
* Set additional categories (you can duplicate the primary category here, but
* you shouldn't)
*
* @return Any additional categories * @return Any additional categories
*/ */
public List<MapWithAICategory> getAdditionalCategories() { public List<MapWithAICategory> getAdditionalCategories() {

Wyświetl plik

@ -10,7 +10,6 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -34,229 +33,221 @@ public final class Access {
ALL_TRANSPORT_TYPE("all"), ALL_TRANSPORT_TYPE("all"),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:access">Key:access</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:access">Key:access</a>
*/ */
ACCESS_KEY("access", ALL_TRANSPORT_TYPE), ACCESS_KEY("access", ALL_TRANSPORT_TYPE),
// Access tag values // Access tag values
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Dyes">Tag:access%3Dyes</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Dyes">Tag:access%3Dyes</a>
*/ */
YES("yes"), YES("yes"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Dofficial">Tag:access%3Dofficial</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Dofficial">Tag:access%3Dofficial</a>
*/ */
OFFICIAL("official"), OFFICIAL("official"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddesignated">Tag:access%3Ddesignated</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddesignated">Tag:access%3Ddesignated</a>
*/ */
DESIGNATED("designated"), DESIGNATED("designated"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddestination">Tag:access%3Ddestination</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddestination">Tag:access%3Ddestination</a>
*/ */
DESTINATION("destination"), DESTINATION("destination"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddelivery">Tag:access%3Ddelivery</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddelivery">Tag:access%3Ddelivery</a>
*/ */
DELIVERY("delivery"), DELIVERY("delivery"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Dcustomers">Tag:access%3Dcustomers</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Dcustomers">Tag:access%3Dcustomers</a>
*/ */
CUSTOMERS("customers"), CUSTOMERS("customers"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Dpermissive">Tag:access%3Dpermissive</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Dpermissive">Tag:access%3Dpermissive</a>
*/ */
PERMISSIVE("permissive"), PERMISSIVE("permissive"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Dagricultural">Tag:access%3Dagricultural</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Dagricultural">Tag:access%3Dagricultural</a>
*/ */
AGRICULTURAL("agricultural"), AGRICULTURAL("agricultural"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Dforestry">Tag:access%3Dforestry</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Dforestry">Tag:access%3Dforestry</a>
*/ */
FORESTRY("forestry"), FORESTRY("forestry"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Dprivate">Tag:access%3Dprivate</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Dprivate">Tag:access%3Dprivate</a>
*/ */
PRIVATE("private"), PRIVATE("private"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Dno">Tag:access%3Dno</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Dno">Tag:access%3Dno</a>
*/ */
NO("no"), NO("no"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddiscouraged">Tag:access%3Ddiscouraged</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddiscouraged">Tag:access%3Ddiscouraged</a>
*/ */
DISCOURAGED("discouraged"), DISCOURAGED("discouraged"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Duse_sidepath">Tag:access%3Duse_sidepath</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Duse_sidepath">Tag:access%3Duse_sidepath</a>
*/ */
USE_SIDEPATH("use_sidepath"), USE_SIDEPATH("use_sidepath"),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddismount">Tag:access%3Ddismount</a> * "https://wiki.openstreetmap.org/wiki/Tag:access%3Ddismount">Tag:access%3Ddismount</a>
*/ */
DISMOUNT("dismount"), DISMOUNT("dismount"),
// Land // Land
/** Land transport types */ /** Land transport types */
LAND_TRANSPORT_TYPE("land", ALL_TRANSPORT_TYPE), LAND_TRANSPORT_TYPE("land", ALL_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:vehicle">Key:vehicle</a>
* "https://wiki.openstreetmap.org/wiki/Key:vehicle">Key:vehicle</a>
*/ */
VEHICLE("vehicle", LAND_TRANSPORT_TYPE), VEHICLE("vehicle", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:motor_vehicle">Key:motor_vehicle</a> * "https://wiki.openstreetmap.org/wiki/Key:motor_vehicle">Key:motor_vehicle</a>
*/ */
MOTOR_VEHICLE("motor_vehicle", LAND_TRANSPORT_TYPE), MOTOR_VEHICLE("motor_vehicle", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:trailer">Key:trailer</a>
* "https://wiki.openstreetmap.org/wiki/Key:trailer">Key:trailer</a>
*/ */
TRAILER("trailer", LAND_TRANSPORT_TYPE), TRAILER("trailer", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:foot">Key:foot</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:foot">Key:foot</a> */
FOOT("foot", LAND_TRANSPORT_TYPE), FOOT("foot", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:ski">Key:ski</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:ski">Key:ski</a> */
SKI("ski", LAND_TRANSPORT_TYPE), SKI("ski", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:inline_skates">Key:inline_skates</a> * "https://wiki.openstreetmap.org/wiki/Key:inline_skates">Key:inline_skates</a>
*/ */
INLINE_SKATES("inline_skates", LAND_TRANSPORT_TYPE), INLINE_SKATES("inline_skates", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:ice_skates">Key:ice_skates</a> * "https://wiki.openstreetmap.org/wiki/Key:ice_skates">Key:ice_skates</a>
*/ */
ICE_SKATES("ice_skates", LAND_TRANSPORT_TYPE), ICE_SKATES("ice_skates", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:horse">Key:horse</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:horse">Key:horse</a>
*/ */
HORSE("horse", LAND_TRANSPORT_TYPE), HORSE("horse", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:bicycle">Key:bicycle</a>
* "https://wiki.openstreetmap.org/wiki/Key:bicycle">Key:bicycle</a>
*/ */
BICYCLE("bicycle", LAND_TRANSPORT_TYPE), BICYCLE("bicycle", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:carriage">Key:carriage</a>
* "https://wiki.openstreetmap.org/wiki/Key:carriage">Key:carriage</a>
*/ */
CARRIAGE("carriage", LAND_TRANSPORT_TYPE), CARRIAGE("carriage", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:caravan">Key:caravan</a>
* "https://wiki.openstreetmap.org/wiki/Key:caravan">Key:caravan</a>
*/ */
CARAVAN("caravan", LAND_TRANSPORT_TYPE), CARAVAN("caravan", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:motorcycle">Key:motorcycle</a> * "https://wiki.openstreetmap.org/wiki/Key:motorcycle">Key:motorcycle</a>
*/ */
MOTORCYCLE("motorcycle", LAND_TRANSPORT_TYPE), MOTORCYCLE("motorcycle", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:moped">Key:moped</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:moped">Key:moped</a>
*/ */
MOPED("moped", LAND_TRANSPORT_TYPE), MOPED("moped", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:mofa">Key:mofa</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:mofa">Key:mofa</a> */
MOFA("mofa", LAND_TRANSPORT_TYPE), MOFA("mofa", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:motorcar">Key:motorcar</a>
* "https://wiki.openstreetmap.org/wiki/Key:motorcar">Key:motorcar</a>
*/ */
MOTORCAR("motorcar", LAND_TRANSPORT_TYPE), MOTORCAR("motorcar", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:motorhome">Key:motorhome</a> * "https://wiki.openstreetmap.org/wiki/Key:motorhome">Key:motorhome</a>
*/ */
MOTORHOME("motorhome", LAND_TRANSPORT_TYPE), MOTORHOME("motorhome", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:psv">Key:psv</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:psv">Key:psv</a> */
PSV("psv", LAND_TRANSPORT_TYPE), PSV("psv", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:bus">Key:bus</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:bus">Key:bus</a> */
BUS("bus", LAND_TRANSPORT_TYPE), BUS("bus", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:taxi">Key:taxi</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:taxi">Key:taxi</a> */
TAXI("taxi", LAND_TRANSPORT_TYPE), TAXI("taxi", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:tourist_bus">Key:tourist_bus</a> * "https://wiki.openstreetmap.org/wiki/Key:tourist_bus">Key:tourist_bus</a>
*/ */
TOURIST_BUS("tourist_bus", LAND_TRANSPORT_TYPE), TOURIST_BUS("tourist_bus", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:goods">Key:goods</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:goods">Key:goods</a>
*/ */
GOODS("goods", LAND_TRANSPORT_TYPE), GOODS("goods", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:hgv">Key:hgv</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:hgv">Key:hgv</a> */
HGV("hgv", LAND_TRANSPORT_TYPE), HGV("hgv", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:atv">Key:atv</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:atv">Key:atv</a> */
ATV("atv", LAND_TRANSPORT_TYPE), ATV("atv", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:snowmobile">Key:snowmobile</a> * "https://wiki.openstreetmap.org/wiki/Key:snowmobile">Key:snowmobile</a>
*/ */
SNOWMOBILE("snowmobile", LAND_TRANSPORT_TYPE), SNOWMOBILE("snowmobile", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:hgv_articulated">Key:hgv_articulated</a> * "https://wiki.openstreetmap.org/wiki/Key:hgv_articulated">Key:hgv_articulated</a>
*/ */
HGV_ARTICULATED("hgv_articulated", LAND_TRANSPORT_TYPE), HGV_ARTICULATED("hgv_articulated", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:ski">Key:ski</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:ski">Key:ski</a> */
SKI_NORDIC("ski:nordic", LAND_TRANSPORT_TYPE), SKI_NORDIC("ski:nordic", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:ski">Key:ski</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:ski">Key:ski</a> */
SKI_ALPINE("ski:alpine", LAND_TRANSPORT_TYPE), SKI_ALPINE("ski:alpine", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:ski">Key:ski</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:ski">Key:ski</a> */
SKI_TELEMARK("ski:telemark", LAND_TRANSPORT_TYPE), SKI_TELEMARK("ski:telemark", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:coach">Key:coach</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:coach">Key:coach</a>
*/ */
COACH("coach", LAND_TRANSPORT_TYPE), COACH("coach", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:golf_cart">Key:golf_cart</a> * "https://wiki.openstreetmap.org/wiki/Key:golf_cart">Key:golf_cart</a>
*/ */
GOLF_CART("golf_cart", LAND_TRANSPORT_TYPE), GOLF_CART("golf_cart", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:minibus">Key:minibus</a>
* "https://wiki.openstreetmap.org/wiki/Key:minibus">Key:minibus</a>
*/ */
MINIBUS("minibus", LAND_TRANSPORT_TYPE), MINIBUS("minibus", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:share_taxi">Key:share_taxi</a> * "https://wiki.openstreetmap.org/wiki/Key:share_taxi">Key:share_taxi</a>
*/ */
SHARE_TAXI("share_taxi", LAND_TRANSPORT_TYPE), SHARE_TAXI("share_taxi", LAND_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:hov">Key:hov</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:hov">Key:hov</a> */
HOV("hov", LAND_TRANSPORT_TYPE), HOV("hov", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:car_sharing">Key:car_sharing</a> * "https://wiki.openstreetmap.org/wiki/Key:car_sharing">Key:car_sharing</a>
*/ */
CAR_SHARING("car_sharing", LAND_TRANSPORT_TYPE), CAR_SHARING("car_sharing", LAND_TRANSPORT_TYPE),
/** /**
* Routers should default to {@code yes}, regardless of higher access rules, * Routers should default to {@code yes}, regardless of higher access rules,
* assuming it is navigatible by vehicle * assuming it is navigatible by vehicle
* *
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:emergency">Key:emergency</a> * "https://wiki.openstreetmap.org/wiki/Key:emergency">Key:emergency</a>
*/ */
EMERGENCY("emergency", LAND_TRANSPORT_TYPE), EMERGENCY("emergency", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:hazmat">Key:hazmat</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:hazmat">Key:hazmat</a>
*/ */
HAZMAT("hazmat", LAND_TRANSPORT_TYPE), HAZMAT("hazmat", LAND_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:disabled">Key:disabled</a>
* "https://wiki.openstreetmap.org/wiki/Key:disabled">Key:disabled</a>
*/ */
DISABLED("disabled", LAND_TRANSPORT_TYPE), DISABLED("disabled", LAND_TRANSPORT_TYPE),
@ -264,71 +255,69 @@ public final class Access {
/** Water transport type */ /** Water transport type */
WATER_TRANSPORT_TYPE("water", ALL_TRANSPORT_TYPE), WATER_TRANSPORT_TYPE("water", ALL_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:swimming">Key:swimming</a>
* "https://wiki.openstreetmap.org/wiki/Key:swimming">Key:swimming</a>
*/ */
SWIMMING("swimming", WATER_TRANSPORT_TYPE), SWIMMING("swimming", WATER_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:boat">Key:boat</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:boat">Key:boat</a> */
BOAT("boat", WATER_TRANSPORT_TYPE), BOAT("boat", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:fishing_vessel">Key:fishing_vessel</a> * "https://wiki.openstreetmap.org/wiki/Key:fishing_vessel">Key:fishing_vessel</a>
*/ */
FISHING_VESSEL("fishing_vessel", WATER_TRANSPORT_TYPE), FISHING_VESSEL("fishing_vessel", WATER_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:ship">Key:ship</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:ship">Key:ship</a> */
SHIP("ship", WATER_TRANSPORT_TYPE), SHIP("ship", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:motorboat">Key:motorboat</a> * "https://wiki.openstreetmap.org/wiki/Key:motorboat">Key:motorboat</a>
*/ */
MOTORBOAT("motorboat", WATER_TRANSPORT_TYPE), MOTORBOAT("motorboat", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href= "https://wiki.openstreetmap.org/wiki/Key:sailboat">Key:sailboat</a>
* "https://wiki.openstreetmap.org/wiki/Key:sailboat">Key:sailboat</a>
*/ */
SAILBOAT("sailboat", WATER_TRANSPORT_TYPE), SAILBOAT("sailboat", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:canoe">Key:canoe</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:canoe">Key:canoe</a>
*/ */
CANOE("canoe", WATER_TRANSPORT_TYPE), CANOE("canoe", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:passenger">Key:passenger</a> * "https://wiki.openstreetmap.org/wiki/Key:passenger">Key:passenger</a>
*/ */
PASSENGER("passenger", WATER_TRANSPORT_TYPE), PASSENGER("passenger", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:cargo">Key:cargo</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:cargo">Key:cargo</a>
*/ */
CARGO("cargo", WATER_TRANSPORT_TYPE), CARGO("cargo", WATER_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:isps">Key:isps</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:isps">Key:isps</a> */
ISPS("isps", WATER_TRANSPORT_TYPE), ISPS("isps", WATER_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:bulk">Key:bulk</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:bulk">Key:bulk</a> */
BULK("bulk", WATER_TRANSPORT_TYPE), BULK("bulk", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a>
*/ */
TANKER("tanker", WATER_TRANSPORT_TYPE), TANKER("tanker", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href= * <a href=
* "https://wiki.openstreetmap.org/wiki/Key:container">Key:container</a> * "https://wiki.openstreetmap.org/wiki/Key:container">Key:container</a>
*/ */
CONTAINER("container", WATER_TRANSPORT_TYPE), CONTAINER("container", WATER_TRANSPORT_TYPE),
/** @see <a href="https://wiki.openstreetmap.org/wiki/Key:imdg">Key:imdg</a> */ /** <a href="https://wiki.openstreetmap.org/wiki/Key:imdg">Key:imdg</a> */
IMDG("imdg", WATER_TRANSPORT_TYPE), IMDG("imdg", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a>
*/ */
TANKER_GAS("tanker:gas", WATER_TRANSPORT_TYPE), TANKER_GAS("tanker:gas", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a>
*/ */
TANKER_OIL("tanker:oil", WATER_TRANSPORT_TYPE), TANKER_OIL("tanker:oil", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a>
*/ */
TANKER_CHEMICAL("tanker:chemical", WATER_TRANSPORT_TYPE), TANKER_CHEMICAL("tanker:chemical", WATER_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:tanker">Key:tanker</a>
*/ */
TANKER_SINGLEHULL("tanker:singlehull", WATER_TRANSPORT_TYPE), TANKER_SINGLEHULL("tanker:singlehull", WATER_TRANSPORT_TYPE),
@ -336,7 +325,7 @@ public final class Access {
/** Rail transport type */ /** Rail transport type */
RAIL_TRANSPORT_TYPE("rail", ALL_TRANSPORT_TYPE), RAIL_TRANSPORT_TYPE("rail", ALL_TRANSPORT_TYPE),
/** /**
* @see <a href="https://wiki.openstreetmap.org/wiki/Key:train">Key:train</a> * <a href="https://wiki.openstreetmap.org/wiki/Key:train">Key:train</a>
*/ */
TRAIN("train", RAIL_TRANSPORT_TYPE); TRAIN("train", RAIL_TRANSPORT_TYPE);
@ -354,13 +343,17 @@ public final class Access {
} }
/** /**
* @return The key for the enum * Get the key for the enum
*
* @return The OpenStreetMap key
*/ */
public String getKey() { public String getKey() {
return key; return key;
} }
/** /**
* Get the generic type of transport
*
* @return The AccessTags transport type * @return The AccessTags transport type
* (RAIL_TRANSPORT_TYPE/WATER_TRANSPORT_TYPE/etc) * (RAIL_TRANSPORT_TYPE/WATER_TRANSPORT_TYPE/etc)
*/ */
@ -452,8 +445,9 @@ public final class Access {
} }
/** /**
* Create the default access inheritance, as defined at * Create the default access inheritance, as defined at <a href=
* {@link "https://wiki.openstreetmap.org/wiki/Key:access#Transport_mode_restrictions"} * "https://wiki.openstreetmap.org/wiki/Key:access#Transport_mode_restrictions">
* Key:access#Transport_mod_restrictions </a>
*/ */
private static void defaultInheritance() { private static void defaultInheritance() {
addMode(null, AccessTags.ACCESS_KEY); addMode(null, AccessTags.ACCESS_KEY);
@ -612,9 +606,8 @@ public final class Access {
/** /**
* Get the valid restriction values ({@code unknown} is not included). See * Get the valid restriction values ({@code unknown} is not included). See
* *
* @return Valid values for restrictions (unmodifiable) * @return Valid values for restrictions (unmodifiable) <a href=
* @see <a href= * "https://wiki.openstreetmap.org/wiki/Key:access#List_of_possible_values">Key:access#List_of_possible_values</a>
* "https://wiki.openstreetmap.org/wiki/Key:access#List_of_possible_values">Key:access#List_of_possible_values</a>
*/ */
public static Set<String> getRestrictionValues() { public static Set<String> getRestrictionValues() {
return Collections.unmodifiableSet(RESTRICTION_VALUES); return Collections.unmodifiableSet(RESTRICTION_VALUES);
@ -623,31 +616,13 @@ public final class Access {
/** /**
* Get the valid transport modes. See * Get the valid transport modes. See
* *
* @return Value transport modes (unmodifiable) * @return Value transport modes (unmodifiable) <a href=
* @see <a href= * "https://wiki.openstreetmap.org/wiki/Key:access#Transport_mode_restrictions">Key:access#Transport_mode_restrictions</a>
* "https://wiki.openstreetmap.org/wiki/Key:access#Transport_mode_restrictions">Key:access#Transport_mode_restrictions</a>
*/ */
public static Set<String> getTransportModes() { public static Set<String> getTransportModes() {
return Collections.unmodifiableSet(TRANSPORT_MODES); return Collections.unmodifiableSet(TRANSPORT_MODES);
} }
/**
* Get the access method hierarchy.
*
* @return The hierarchy for access modes (unmodifiable)
* @see <a href=
* "https://wiki.openstreetmap.org/wiki/Key:access#Transport_mode_restrictions">Key:access#Transport_mode_restrictions</a>
*/
public static Map<String, Map<String, List<String>>> getAccessMethods() {
Map<String, Map<String, List<String>>> map = new HashMap<>();
for (Entry<String, Map<String, List<String>>> entry : map.entrySet()) {
Map<String, List<String>> tMap = new HashMap<>();
entry.getValue().forEach((key, list) -> tMap.put(key, Collections.unmodifiableList(list)));
map.put(entry.getKey(), Collections.unmodifiableMap(tMap));
}
return Collections.unmodifiableMap(map);
}
/** /**
* Get the implied access values for a primitive * Get the implied access values for a primitive
* *