Class ConditionalKeys
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.Test.TagTest
-
- org.openstreetmap.josm.data.validation.tests.ConditionalKeys
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class ConditionalKeys extends Test.TagTest
Checks for conditional restrictions- Since:
- 6605
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ConditionalKeys.ConditionalParsingException
static class
ConditionalKeys.ConditionalValue
A conditional value is a value for the access restriction tag that depends on conditions (time, ...)-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.Pattern
CONDITIONAL_PATTERN
private OpeningHourTest
openingHourTest
private static java.util.Set<java.lang.String>
RESTRICTION_TYPES
private static java.util.Set<java.lang.String>
RESTRICTION_VALUES
private static java.util.Set<java.lang.String>
TRANSPORT_MODES
-
Fields inherited from class org.openstreetmap.josm.data.validation.Test
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, stopwatch, testBeforeUpload
-
-
Constructor Summary
Constructors Constructor Description ConditionalKeys()
Constructs a newConditionalKeys
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
check(OsmPrimitive p)
Checks the tags of the given primitive.void
initialize()
Initializes any global data used this tester.static boolean
isDirection(java.lang.String part)
Check if a key part is a valid directionboolean
isKeyValid(java.lang.String key)
Checks if a given key is a valid access keyprivate static boolean
isKeyValid1Part(java.lang.String... parts)
private static boolean
isKeyValid2Parts(java.lang.String... parts)
private static boolean
isKeyValid3Parts(java.lang.String... parts)
static boolean
isRestrictionType(java.lang.String part)
Check if the key is a key for an access restrictionstatic boolean
isRestrictionValue(java.lang.String part)
Check if the value is a valid restriction valuestatic boolean
isTransportationMode(java.lang.String part)
Checks if the key denotes a transport access mode restrictionboolean
isValueValid(java.lang.String key, java.lang.String value)
Check if a value is validjava.util.List<TestError>
validatePrimitive(OsmPrimitive p)
Validate a primitivejava.lang.String
validateValue(java.lang.String key, java.lang.String value)
Validate a key/value pair-
Methods inherited from class org.openstreetmap.josm.data.validation.Test.TagTest
includeOtherSeverityChecks, visit, visit, visit
-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, clear, deletePrimitivesIfNeeded, endTest, fixError, getErrors, getName, getSource, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, ok, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, startTest, testBeforeUpload, visit
-
-
-
-
Field Detail
-
openingHourTest
private final OpeningHourTest openingHourTest
-
RESTRICTION_TYPES
private static final java.util.Set<java.lang.String> RESTRICTION_TYPES
-
RESTRICTION_VALUES
private static final java.util.Set<java.lang.String> RESTRICTION_VALUES
-
TRANSPORT_MODES
private static final java.util.Set<java.lang.String> TRANSPORT_MODES
-
CONDITIONAL_PATTERN
private static final java.util.regex.Pattern CONDITIONAL_PATTERN
-
-
Constructor Detail
-
ConditionalKeys
public ConditionalKeys()
Constructs a newConditionalKeys
.
-
-
Method Detail
-
initialize
public void initialize() throws java.lang.Exception
Description copied from class:Test
Initializes any global data used this tester.- Overrides:
initialize
in classTest
- Throws:
java.lang.Exception
- When cannot initialize the test
-
isRestrictionType
public static boolean isRestrictionType(java.lang.String part)
Check if the key is a key for an access restriction- Parameters:
part
- The key (or the restriction part of it, e.g. for lanes)- Returns:
true
if it is a restriction
-
isRestrictionValue
public static boolean isRestrictionValue(java.lang.String part)
Check if the value is a valid restriction value- Parameters:
part
- The value- Returns:
true
for allowed restriction values
-
isTransportationMode
public static boolean isTransportationMode(java.lang.String part)
Checks if the key denotes a transport access mode restriction- Parameters:
part
- The key (or the restriction part of it, e.g. for lanes)- Returns:
true
if it is a restriction
-
isDirection
public static boolean isDirection(java.lang.String part)
Check if a key part is a valid direction- Parameters:
part
- The part of the key- Returns:
true
if it is a direction
-
isKeyValid
public boolean isKeyValid(java.lang.String key)
Checks if a given key is a valid access key- Parameters:
key
- The conditional key- Returns:
true
if the key is valid
-
isKeyValid3Parts
private static boolean isKeyValid3Parts(java.lang.String... parts)
-
isKeyValid2Parts
private static boolean isKeyValid2Parts(java.lang.String... parts)
-
isKeyValid1Part
private static boolean isKeyValid1Part(java.lang.String... parts)
-
isValueValid
public boolean isValueValid(java.lang.String key, java.lang.String value)
Check if a value is valid- Parameters:
key
- The key the value is forvalue
- The value- Returns:
true
if it is valid
-
validateValue
public java.lang.String validateValue(java.lang.String key, java.lang.String value)
Validate a key/value pair- Parameters:
key
- The keyvalue
- The value- Returns:
- The error message for that value or
null
to indicate valid
-
validatePrimitive
public java.util.List<TestError> validatePrimitive(OsmPrimitive p)
Validate a primitive- Parameters:
p
- The primitive- Returns:
- The errors for that primitive or an empty list if there are no errors.
-
check
public void check(OsmPrimitive p)
Description copied from class:Test.TagTest
Checks the tags of the given primitive.- Specified by:
check
in classTest.TagTest
- Parameters:
p
- The primitive to test
-
-