Class NameMismatch
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.Test.TagTest
-
- org.openstreetmap.josm.data.validation.tests.NameMismatch
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class NameMismatch extends Test.TagTest
Check for missing name:* translations.This test finds multilingual objects whose 'name' attribute is not equal to any 'name:*' attribute and not a composition of some 'name:*' attributes separated by ' - '.
For example, a node with name=Europe, name:de=Europa should have name:en=Europe to avoid triggering this test. An object with name='Suomi - Finland' should have at least name:fi=Suomi and name:sv=Finland to avoid a warning (name:et=Soome would not matter). Also, complain if an object has some name:* attribute but no name.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description private static List<String>
EXCLUSIONS
protected static int
NAME_MISSING
private static Pattern
NAME_SPLIT_PATTERN
protected static int
NAME_TRANSLATION_MISSING
-
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 NameMismatch()
Constructs a newNameMismatch
test.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
check(OsmPrimitive p)
Check a primitive for a name mismatch.boolean
isPrimitiveUsable(OsmPrimitive p)
Determines if the primitive is usable for tests.private void
missingTranslation(OsmPrimitive p, String name)
Report a missing translation.-
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, initialize, isBuilding, isCanceled, isFixable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, startTest, testBeforeUpload, visit
-
-
-
-
Field Detail
-
NAME_MISSING
protected static final int NAME_MISSING
- See Also:
- Constant Field Values
-
NAME_TRANSLATION_MISSING
protected static final int NAME_TRANSLATION_MISSING
- See Also:
- Constant Field Values
-
NAME_SPLIT_PATTERN
private static final Pattern NAME_SPLIT_PATTERN
-
EXCLUSIONS
private static final List<String> EXCLUSIONS
-
-
Constructor Detail
-
NameMismatch
public NameMismatch()
Constructs a newNameMismatch
test.
-
-
Method Detail
-
missingTranslation
private void missingTranslation(OsmPrimitive p, String name)
Report a missing translation.- Parameters:
p
- The primitive whose translation is missingname
- The name whose translation is missing
-
check
public void check(OsmPrimitive p)
Check a primitive for a name mismatch.- Specified by:
check
in classTest.TagTest
- Parameters:
p
- The primitive to be tested
-
isPrimitiveUsable
public boolean isPrimitiveUsable(OsmPrimitive p)
Description copied from class:Test
Determines if the primitive is usable for tests.- Overrides:
isPrimitiveUsable
in classTest
- Parameters:
p
- The primitive- Returns:
true
if the primitive can be tested,false
otherwise
-
-