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 java.util.List<java.lang.String>EXCLUSIONSprotected static intNAME_MISSINGprivate static java.util.regex.PatternNAME_SPLIT_PATTERNprotected static intNAME_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 newNameMismatchtest.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheck(OsmPrimitive p)Check a primitive for a name mismatch.booleanisPrimitiveUsable(OsmPrimitive p)Determines if the primitive is usable for tests.private voidmissingTranslation(OsmPrimitive p, java.lang.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, removeIrrelevantErrors, 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 java.util.regex.Pattern NAME_SPLIT_PATTERN
-
EXCLUSIONS
private static final java.util.List<java.lang.String> EXCLUSIONS
-
-
Constructor Detail
-
NameMismatch
public NameMismatch()
Constructs a newNameMismatchtest.
-
-
Method Detail
-
missingTranslation
private void missingTranslation(OsmPrimitive p, java.lang.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:
checkin classTest.TagTest- Parameters:
p- The primitive to be tested
-
isPrimitiveUsable
public boolean isPrimitiveUsable(OsmPrimitive p)
Description copied from class:TestDetermines if the primitive is usable for tests.- Overrides:
isPrimitiveUsablein classTest- Parameters:
p- The primitive- Returns:
trueif the primitive can be tested,falseotherwise
-
-