public class OpeningHourTest extends Test.TagTest
opening_hours
, collection_times
, service_times
according to
opening_hours.js.Modifier and Type | Class and Description |
---|---|
(package private) static class |
OpeningHourTest.CheckMode |
class |
OpeningHourTest.OpeningHoursTestError
An error concerning invalid syntax for an "opening_hours"-like tag.
|
Test.TagTest
Modifier and Type | Field and Description |
---|---|
static javax.script.ScriptEngine |
ENGINE
Javascript engine
|
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, isBeforeUpload, name, partialSelection, progressMonitor, startTime, testBeforeUpload
Constructor and Description |
---|
OpeningHourTest()
Constructs a new
OpeningHourTest . |
Modifier and Type | Method and Description |
---|---|
void |
check(OsmPrimitive p)
Checks the tags of the given primitive.
|
protected void |
check(OsmPrimitive p,
java.lang.String key,
OpeningHourTest.CheckMode mode) |
java.util.List<OpeningHourTest.OpeningHoursTestError> |
checkOpeningHourSyntax(java.lang.String key,
java.lang.String value)
Checks for a correct usage of the opening hour syntax of the
value given, in time range mode, according to
opening_hours.js and returns a list containing
validation errors or an empty list. |
java.util.List<OpeningHourTest.OpeningHoursTestError> |
checkOpeningHourSyntax(java.lang.String key,
java.lang.String value,
OpeningHourTest.CheckMode mode)
Checks for a correct usage of the opening hour syntax of the
value given according to
opening_hours.js and returns a list containing
validation errors or an empty list. |
java.util.List<OpeningHourTest.OpeningHoursTestError> |
checkOpeningHourSyntax(java.lang.String key,
java.lang.String value,
OpeningHourTest.CheckMode mode,
boolean ignoreOtherSeverity,
java.lang.String locale)
Checks for a correct usage of the opening hour syntax of the
value given according to
opening_hours.js and returns a list containing
validation errors or an empty list. |
private static java.lang.String |
getErrorMessage(java.lang.String key,
java.lang.Object o)
Translates and shortens the error/warning message.
|
protected java.util.List<java.lang.Object> |
getList(java.lang.Object obj) |
void |
initialize()
Initializes any global data used this tester.
|
protected java.lang.Object |
parse(java.lang.String value,
OpeningHourTest.CheckMode mode,
java.lang.String locale) |
visit, visit, visit
addGui, deletePrimitivesIfNeeded, endTest, equals, fixError, getErrors, getName, hashCode, isBuilding, isCanceled, isFixable, isPrimitiveUsable, ok, setBeforeUpload, setPartialSelection, startTest, testBeforeUpload, visit
visit
public static final javax.script.ScriptEngine ENGINE
public OpeningHourTest()
OpeningHourTest
.public void initialize() throws java.lang.Exception
Test
initialize
in class Test
java.lang.Exception
- When cannot initialize the testprotected java.lang.Object parse(java.lang.String value, OpeningHourTest.CheckMode mode, java.lang.String locale) throws javax.script.ScriptException, java.lang.NoSuchMethodException
javax.script.ScriptException
java.lang.NoSuchMethodException
protected java.util.List<java.lang.Object> getList(java.lang.Object obj) throws javax.script.ScriptException, java.lang.NoSuchMethodException
javax.script.ScriptException
java.lang.NoSuchMethodException
public java.util.List<OpeningHourTest.OpeningHoursTestError> checkOpeningHourSyntax(java.lang.String key, java.lang.String value, OpeningHourTest.CheckMode mode)
value
given according to
opening_hours.js and returns a list containing
validation errors or an empty list. Null values result in an empty list.key
- the OSM key (should be "opening_hours", "collection_times" or "service_times"). Used in error messagevalue
- the opening hour value to be checked.mode
- whether to validate value
as a time range, or points in time, or both.TestError
or an empty listpublic java.util.List<OpeningHourTest.OpeningHoursTestError> checkOpeningHourSyntax(java.lang.String key, java.lang.String value, OpeningHourTest.CheckMode mode, boolean ignoreOtherSeverity, java.lang.String locale)
value
given according to
opening_hours.js and returns a list containing
validation errors or an empty list. Null values result in an empty list.key
- the OSM key (should be "opening_hours", "collection_times" or "service_times").value
- the opening hour value to be checked.mode
- whether to validate value
as a time range, or points in time, or both.ignoreOtherSeverity
- whether to ignore errors with Severity.OTHER
.locale
- the locale code used for localizing messagesTestError
or an empty listprivate static java.lang.String getErrorMessage(java.lang.String key, java.lang.Object o)
key
- OSM keyo
- error/warnign messagepublic java.util.List<OpeningHourTest.OpeningHoursTestError> checkOpeningHourSyntax(java.lang.String key, java.lang.String value)
value
given, in time range mode, according to
opening_hours.js and returns a list containing
validation errors or an empty list. Null values result in an empty list.key
- the OSM key (should be "opening_hours", "collection_times" or "service_times"). Used in error messagevalue
- the opening hour value to be checked.TestError
or an empty listprotected void check(OsmPrimitive p, java.lang.String key, OpeningHourTest.CheckMode mode)
public void check(OsmPrimitive p)
Test.TagTest
check
in class Test.TagTest
p
- The primitive to test