Class OpeningHourTest

All Implemented Interfaces:
OsmPrimitiveVisitor

public class OpeningHourTest extends Test.TagTest
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)
  • Field Details

  • Constructor Details

    • OpeningHourTest

      public OpeningHourTest()
      Constructs a new OpeningHourTest.
  • 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 severity
      message - The error message
      key - The incriminated key, used for display.
      value - The incriminated value, used for comparison with prettified value.
      prettifiedValue - The prettified value
      p - 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 the value given, 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 message
      value - the opening hour value to be checked.
      Returns:
      a list of TestError or an empty list
    • checkOpeningHourSyntax

      Checks for a correct usage of the opening hour syntax of the value given, 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 TestError or an empty list
    • check

      public void check(OsmPrimitive p)
      Description copied from class: Test.TagTest
      Checks the tags of the given primitive.
      Specified by:
      check in class Test.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 test
      errors - The list to add validation errors to
      Since:
      17643
    • addGui

      public void addGui(JPanel testPanel)
      Description copied from class: Test
      Allow the tester to manage its own preferences
      Overrides:
      addGui in class Test
      Parameters:
      testPanel - The panel to add any preferences component
    • ok

      public boolean ok()
      Description copied from class: Test
      Called when the used submits the preferences
      Overrides:
      ok in class Test
      Returns:
      true if restart is required, false otherwise