public class MapCSSTagChecker extends Test.TagTest
Modifier and Type | Class and Description |
---|---|
(package private) static interface |
MapCSSTagChecker.FixCommand
Represents a fix to a validation test.
|
static class |
MapCSSTagChecker.GroupedMapCSSRule
A grouped MapCSSRule with multiple selectors for a single declaration.
|
(package private) static class |
MapCSSTagChecker.MapCSSTagCheckerAndRule |
static class |
MapCSSTagChecker.ParseResult
|
static class |
MapCSSTagChecker.TagCheck
Tag check.
|
Test.TagTest
Modifier and Type | Field and Description |
---|---|
(package private) MultiMap<java.lang.String,MapCSSTagChecker.TagCheck> |
checks |
static java.lang.String |
ENTRIES_PREF_KEY
The preference key for tag checker source entries.
|
(package private) MapCSSTagCheckerIndex |
indexData |
(package private) java.util.Set<OsmPrimitive> |
tested |
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, startTime, testBeforeUpload
Constructor and Description |
---|
MapCSSTagChecker()
Constructs a new
MapCSSTagChecker . |
Modifier and Type | Method and Description |
---|---|
private static void |
addIfNotSimilar(TestError toAdd,
java.util.List<TestError> errors)
See #12627
Add error to given list if list doesn't already contain a similar error.
|
MapCSSTagChecker.ParseResult |
addMapCSS(java.lang.String url)
Adds a new MapCSS config file from the given URL.
|
private static void |
addPrimitive(DataSet ds,
OsmPrimitive p) |
void |
check(OsmPrimitive p)
Visiting call for primitives.
|
java.util.Set<java.lang.String> |
checkAsserts(java.util.Collection<MapCSSTagChecker.TagCheck> schecks)
Checks that rule assertions are met for the given set of TagChecks.
|
void |
endTest()
Notification of the end of the test.
|
java.util.Collection<TestError> |
getErrorsForPrimitive(OsmPrimitive p,
boolean includeOtherSeverity)
|
private static java.util.Collection<TestError> |
getErrorsForPrimitive(OsmPrimitive p,
boolean includeOtherSeverity,
java.util.Collection<java.util.Set<MapCSSTagChecker.TagCheck>> checksCol) |
private static java.util.Optional<java.lang.String> |
getFirstInsideCountry(MapCSSTagChecker.TagCheck check,
java.lang.reflect.Method insideMethod) |
private static java.lang.reflect.Method |
getFunctionMethod(java.lang.String method) |
private static LatLon |
getLocation(MapCSSTagChecker.TagCheck check,
java.lang.reflect.Method insideMethod) |
private boolean |
includeOtherSeverityChecks() |
void |
initialize()
Initializes any global data used this tester.
|
static void |
reloadRule(SourceEntry rule)
Reload tagchecker rule.
|
void |
startTest(ProgressMonitor progressMonitor)
Start the test using a given progress monitor
|
visit, visit, visit
addGui, clear, deletePrimitivesIfNeeded, fixError, getErrors, getName, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit
MapCSSTagCheckerIndex indexData
final java.util.Set<OsmPrimitive> tested
public static final java.lang.String ENTRIES_PREF_KEY
final MultiMap<java.lang.String,MapCSSTagChecker.TagCheck> checks
public MapCSSTagChecker()
MapCSSTagChecker
.public java.util.Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity)
p
- The OSM primitiveincludeOtherSeverity
- if true
, errors of severity Severity.OTHER
(info) will also be returnedprivate static void addIfNotSimilar(TestError toAdd, java.util.List<TestError> errors)
toAdd
- the error to adderrors
- the list of errorsprivate static java.util.Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity, java.util.Collection<java.util.Set<MapCSSTagChecker.TagCheck>> checksCol)
public void check(OsmPrimitive p)
check
in class Test.TagTest
p
- The primitive to inspect.public MapCSSTagChecker.ParseResult addMapCSS(java.lang.String url) throws org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException, java.io.IOException
url
- The unique URL of the MapCSS config fileorg.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException
- if the config file does not match MapCSS syntaxjava.io.IOException
- if any I/O error occurspublic void initialize() throws java.lang.Exception
Test
initialize
in class Test
java.lang.Exception
- When cannot initialize the testprivate static java.lang.reflect.Method getFunctionMethod(java.lang.String method)
private static java.util.Optional<java.lang.String> getFirstInsideCountry(MapCSSTagChecker.TagCheck check, java.lang.reflect.Method insideMethod)
private static LatLon getLocation(MapCSSTagChecker.TagCheck check, java.lang.reflect.Method insideMethod)
public java.util.Set<java.lang.String> checkAsserts(java.util.Collection<MapCSSTagChecker.TagCheck> schecks)
schecks
- The TagChecks for which assertions have to be checkedprivate static void addPrimitive(DataSet ds, OsmPrimitive p)
public static void reloadRule(SourceEntry rule)
rule
- tagchecker rule to reloadpublic void startTest(ProgressMonitor progressMonitor)
Test
public void endTest()
Test
If you override this method, don't forget to cleanup progressMonitor
(most overrides call super.endTest()
to do this).
private boolean includeOtherSeverityChecks()