Class OsmValidator
java.lang.Object
org.openstreetmap.josm.data.validation.OsmValidator
A OSM data validator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Collection<Class<? extends Test>>All registered testsAll available tests in coreprivate static ValidatorLayerprivate static doubleGrid detail, multiplier of east,north values for valuable cell sizingprivate static boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds an ignored errorstatic voidaddIgnoredError(String s, String description) Adds an ignored errorstatic voidAdds a test to the list of available testsprivate static voidapplyPrefs(Map<String, Test> tests, boolean beforeUpload) buildIgnore(JTree tree) Build aHashMapfrom a tree of ignored errorsbuildIgnore(TreeModel model, DefaultMutableTreeNode node) static JTreeBuild a JTree with a list(package private) static voidMake sure that we don't keep single entries for a "group ignore".(package private) static voidFor unit testsprivate static StringExtract the leading digits building the code for the error key.static Collection<Class<? extends Test>>Gets the list of all available test classesGets a map from simple names to all tests.static Collection<Test>getEnabledTests(boolean beforeUpload) Gets all tests that are rungetErrorsBySeverityMessageDescription(Collection<TestError> errors, Predicate<? super TestError> filterToUse) Groups the given collection of errors by severity, then message, then description.static doubleReturns grid detail, multiplier of east,north values for valuable cell sizingGet the list of all ignored errorsstatic <T extends Test>
TReturns the instance of the given test class.static Collection<Test>getTests()Gets all tests that are possiblestatic StringReturns the validator directory.static booleanCheck if a error should be ignoredstatic voidInitializesOsmValidator.static voidInitializes error layer.static voidInitialize grid details based on the current projection system.static voidInitializes all tests if this operation hasn't been performed already.static voidinitializeTests(Collection<? extends Test> allTests) Initializes all testsprivate static DefaultMutableTreeNodeinTree(DefaultMutableTreeNode root, String name) private static voidprivate static voidremoveLegacyEntries(boolean force) private static booleanremoveLegacyEntry(boolean force, boolean keep, String prefix) static booleanremoveTest(Class<? extends Test> testClass) Removes a test from the list of available tests.static voidResets error layer.static voidReset the error list by deletingvalidator.ignorelistprivate static booleanstatic voidSaves the names of the ignored errors to a preference
-
Field Details
-
errorLayer
-
griddetail
Grid detail, multiplier of east,north values for valuable cell sizing -
ignoredErrors
-
allTests
All registered tests -
allTestsMap
-
CORE_TEST_CLASSES
All available tests in core -
testsInitialized
-
-
Constructor Details
-
OsmValidator
private OsmValidator()
-
-
Method Details
-
addTest
Adds a test to the list of available tests- Parameters:
testClass- The test class
-
removeTest
Removes a test from the list of available tests. This will not remove core tests.- Parameters:
testClass- The test class- Returns:
trueif the test was removed (seeCollection.remove(java.lang.Object))- Since:
- 15603
-
initialize
InitializesOsmValidator. -
getValidatorDir
Returns the validator directory.- Returns:
- The validator directory
-
loadIgnoredErrors
-
removeLegacyEntries
-
removeLegacyEntry
-
addIgnoredError
Adds an ignored error- Parameters:
s- The ignore group / sub group name- See Also:
-
addIgnoredError
Adds an ignored error- Parameters:
s- The ignore group / sub group namedescription- What the error actually is- See Also:
-
cleanupIgnoredErrors
Make sure that we don't keep single entries for a "group ignore". -
sameCode
-
extractCodeFromIgnoreKey
Extract the leading digits building the code for the error key.- Parameters:
key- the error key- Returns:
- the leading digits
-
hasIgnoredError
Check if a error should be ignored- Parameters:
s- The ignore group / sub group name- Returns:
trueto ignore that error
-
getIgnoredErrors
Get the list of all ignored errors- Returns:
- The
Collection<String>of errors that are ignored
-
buildJTreeList
Build a JTree with a list- Returns:
- <type>list as a
JTree
-
inTree
-
buildIgnore
Build aHashMapfrom a tree of ignored errors- Parameters:
tree- The JTree of ignored errors- Returns:
- A
HashMapof the ignored errors for comparison
-
buildIgnore
-
resetErrorList
Reset the error list by deletingvalidator.ignorelist -
saveIgnoredErrors
Saves the names of the ignored errors to a preference -
initializeErrorLayer
Initializes error layer. -
resetErrorLayer
Resets error layer.- Since:
- 11852
-
getAllTestsMap
Gets a map from simple names to all tests.- Returns:
- A map of all tests, indexed and sorted by the name of their Java class
-
getTest
Returns the instance of the given test class.- Type Parameters:
T- testClass type- Parameters:
testClass- The class of test to retrieve- Returns:
- the instance of the given test class, if any, or
null - Since:
- 6670
-
applyPrefs
-
getTests
Gets all tests that are possible- Returns:
- The tests
-
getEnabledTests
Gets all tests that are run- Parameters:
beforeUpload- To get the ones that are run before upload- Returns:
- The tests
-
getAllAvailableTestClasses
Gets the list of all available test classes- Returns:
- A collection of the test classes
-
initializeGridDetail
Initialize grid details based on the current projection system. Values based on the original value fixed for EPSG:4326 (10000) using heuristics (that is, test&error until most bugs were discovered while keeping the processing time reasonable) -
getGridDetail
Returns grid detail, multiplier of east,north values for valuable cell sizing- Returns:
- grid detail
- Since:
- 11852
-
initializeTests
Initializes all tests if this operation hasn't been performed already. -
initializeTests
Initializes all tests- Parameters:
allTests- The tests to initialize
-
getErrorsBySeverityMessageDescription
public static Map<Severity,Map<String, getErrorsBySeverityMessageDescriptionMap<String, List<TestError>>>> (Collection<TestError> errors, Predicate<? super TestError> filterToUse) Groups the given collection of errors by severity, then message, then description.- Parameters:
errors- list of errors to groupfilterToUse- optional filter- Returns:
- collection of errors grouped by severity, then message, then description
- Since:
- 12667
-
clearIgnoredErrors
For unit tests
-