Class OpeningHourTest
java.lang.Object
org.openstreetmap.josm.data.validation.Test
org.openstreetmap.josm.data.validation.Test.TagTest
org.openstreetmap.josm.data.validation.tests.OpeningHourTest
- All Implemented Interfaces:
OsmPrimitiveVisitor
Tests the correct usage of the opening hour syntax of the tags
opening_hours, collection_times, service_times according to
OpeningHoursParser.- Since:
- 6370 (using opening_hours.js), 15978 (using OpeningHoursParser)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JCheckBoxprivate static final Collection<String>private static final BooleanPropertyFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrorsForPrimitive(OsmPrimitive p, Collection<TestError> errors) Checks the tags of the given primitive and adds validation errors to the given list.voidAllow the tester to manage its own preferencesvoidChecks the tags of the given primitive.checkOpeningHourSyntax(String key, String value) Checks for a correct usage of the opening hour syntax of thevaluegiven, and returns a list containing validation errors or an empty list.checkOpeningHourSyntax(String key, String value, OsmPrimitive p, Locale locale) Checks for a correct usage of the opening hour syntax of thevaluegiven, and returns a list containing validation errors or an empty list.private TestErrorcreateTestError(Severity severity, String message, String key, String value, String prettifiedValue, OsmPrimitive p) Returns the real test error given to JOSM validator.booleanok()Called when the used submits the preferencesMethods inherited from class org.openstreetmap.josm.data.validation.Test.TagTest
includeOtherSeverityChecks, visit, visit, visitMethods inherited from class org.openstreetmap.josm.data.validation.Test
clear, deletePrimitivesIfNeeded, endTest, fixError, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, startTest, testBeforeUpload, visit
-
Field Details
-
KEYS_TO_CHECK
-
PREF_STRICT_MODE
-
checkboxStrictMode
-
-
Constructor Details
-
OpeningHourTest
public OpeningHourTest()Constructs a newOpeningHourTest.
-
-
Method Details
-
createTestError
private TestError createTestError(Severity severity, String message, String key, String value, String prettifiedValue, OsmPrimitive p) Returns the real test error given to JOSM validator.- Parameters:
severity- The error severitymessage- The error messagekey- The incriminated key, used for display.value- The incriminated value, used for comparison with prettified value.prettifiedValue- The prettified valuep- The incriminated OSM primitive.- Returns:
- The real test error given to JOSM validator. Can be fixable or not if a prettified values has been determined.
-
checkOpeningHourSyntax
Checks for a correct usage of the opening hour syntax of thevaluegiven, and returns a list containing validation errors or an empty list. Null values result in an empty list.- Parameters:
key- the OSM key (should be "opening_hours", "collection_times" or "service_times"). Used in error messagevalue- the opening hour value to be checked.- Returns:
- a list of
TestErroror an empty list
-
checkOpeningHourSyntax
Checks for a correct usage of the opening hour syntax of thevaluegiven, and returns a list containing validation errors or an empty list. Null values result in an empty list.- Parameters:
key- the OSM key (should be "opening_hours", "collection_times" or "service_times").value- the opening hour value to be checked.p- the primitive to check/fix.locale- the locale code used for localizing messages- Returns:
- a list of
TestErroror an empty list
-
check
Description copied from class:Test.TagTestChecks the tags of the given primitive.- Specified by:
checkin classTest.TagTest- Parameters:
p- The primitive to test
-
addErrorsForPrimitive
Checks the tags of the given primitive and adds validation errors to the given list.- Parameters:
p- The primitive to testerrors- The list to add validation errors to- Since:
- 17643
-
addGui
Description copied from class:TestAllow the tester to manage its own preferences -
ok
Description copied from class:TestCalled when the used submits the preferences
-