Class TestError
java.lang.Object
org.openstreetmap.josm.data.validation.TestError
- All Implemented Interfaces:
Comparable<TestError>
Validation error
- Since:
- 3669
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intInternal code used by testers to classify errorsprivate final StringDeeper error descriptionprivate final StringSupplying a command to fix the errorprivate final Collection<?>The primitives or way segments to be highlightedprivate booleanis this error on the ignore listprivate booleanIf all relevant primitives are knownprivate final StringThe error messageprivate final Collection<? extends OsmPrimitive>The affected primitivesprivate booleanIf this error is selectedprivate final SeveritySeverityprivate static booleanUsed to switch users over to new ignore system, UNIQUE_CODE_MESSAGE_STATE 1_704_067_200L → 2024-01-01 We can probably remove this and the supporting code in 2025.private final TestThe tester that raised this errorprivate final intInternal code used by testers to classify errors. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TestError.BuilderStarts building a newTestErrorprivate booleanintintgetCode()Gets the codeGets the error messagegetFix()Fixes the error with the appropriate commandCollection<?>Returns The primitives or way segments to be highlightedgetHiliteNodesForArea(Area area) Calculate list of node pairs describing the area.Gets the ignore group ID that is used to allow the user to ignore all same errorsprivate StringgetIgnoreGroup(boolean useOriginal) Get the ignore groupReturns the ignore state for this error.private StringgetIgnoreState(boolean useOriginal) Get the ignore stateGets the ignores subgroup that is more specialized thangetIgnoreGroup()private StringgetIgnoreSubGroup(boolean useOriginal) Get the subgroup for the errorGets the error messageReturns a newMultipleNameVisitorfor the list of primitives affected by this error.Collection<? extends OsmPrimitive>Gets the list of primitives affected by this errorGets the severity of this errorGets the tester that raised this errorintGet the unique code for this test.private static booleanhighlightedIsEqual(Collection<?> highlighted, Collection<?> highlighted2) booleanisConcerned(Set<? extends OsmPrimitive> given) Check if any of the primitives in this error occurs in the given set of primitives.booleanReturns true if the error can be fixed automaticallybooleanChecks if this error is ignoredbooleanReturns the selection flag of this errorbooleanTests if two errors are similar, i.e., same code and description and same combination of primitives and same combination of highlighted objects, but maybe with different orders.final <T extends OsmPrimitive>
Stream<T>primitives(Class<T> type) Gets all primitives of the given type affected by this errorvoidsetIgnored(boolean state) Flags this error as ignoredvoidsetSelected(boolean selected) Sets the selection flag of this error(package private) static voidsetUpdateErrorCodes(boolean updateErrorCodes) Update error codes on read and save.toString()booleanCheck if this error matches an entry in the ignore list and set the ignored flag if it is.private static voidupdateIgnoreList(String oldKey, String newKey) Convert old keys to new keys.voidVisits all highlighted validation elements
-
Field Details
-
switchOver
Used to switch users over to new ignore system, UNIQUE_CODE_MESSAGE_STATE 1_704_067_200L → 2024-01-01 We can probably remove this and the supporting code in 2025. -
ignored
is this error on the ignore list -
severity
Severity -
message
The error message -
description
Deeper error description -
descriptionEn
-
primitives
The affected primitives -
highlighted
The primitives or way segments to be highlighted -
tester
The tester that raised this error -
code
Internal code used by testers to classify errors -
uniqueCode
Internal code used by testers to classify errors. Used for moving between JOSM versions. -
selected
If this error is selected -
incompletePrimitives
If all relevant primitives are known -
fixingCommand
Supplying a command to fix the error
-
-
Constructor Details
-
TestError
TestError(TestError.Builder builder)
-
-
Method Details
-
setUpdateErrorCodes
Update error codes on read and save. Used for tests.- Parameters:
updateErrorCodes-trueto update error codes. SeeswitchOverfor default.
-
builder
Starts building a newTestError- Parameters:
tester- The testerseverity- The severity of this errorcode- The test error reference code- Returns:
- a new test builder
- Since:
- 11129
-
getMessage
Gets the error message- Returns:
- the error message
-
getDescription
Gets the error message- Returns:
- the error description
-
getPrimitives
Gets the list of primitives affected by this error- Returns:
- the list of primitives affected by this error
-
primitives
Gets all primitives of the given type affected by this error- Type Parameters:
T- type of primitives- Parameters:
type- restrict primitives to subclasses- Returns:
- the primitives as Stream
-
getSeverity
Gets the severity of this error- Returns:
- the severity of this error
-
getIgnoreState
Returns the ignore state for this error.- Returns:
- the ignore state for this error or null if any primitive is new
-
getIgnoreState
Get the ignore state- Parameters:
useOriginal- iftrue, use the original code to get the ignore state- Returns:
- The ignore state (
getIgnoreGroup()+ ignored object list)
-
updateIgnored
Check if this error matches an entry in the ignore list and set the ignored flag if it is.- Returns:
- the new ignored state
-
calcIgnored
-
updateIgnoreList
Convert old keys to new keys. Only takes effect whenswitchOveris true- Parameters:
oldKey- The key to replacenewKey- The new key
-
getIgnoreSubGroup
Gets the ignores subgroup that is more specialized thangetIgnoreGroup()- Returns:
- The ignore sub group
-
getIgnoreSubGroup
Get the subgroup for the error- Parameters:
useOriginal- iftrue, use the original code instead of the new unique codes.- Returns:
- The ignore subgroup
-
getIgnoreGroup
Gets the ignore group ID that is used to allow the user to ignore all same errors- Returns:
- The group id
- See Also:
-
getIgnoreGroup
Get the ignore group- Parameters:
useOriginal- iftrue, use the original code instead of a unique code + original code. Used for reading and understanding old ignore groups.- Returns:
- The ignore group.
-
setIgnored
Flags this error as ignored- Parameters:
state- The ignore flag
-
isIgnored
Checks if this error is ignored- Returns:
trueif it is ignored
-
getTester
Gets the tester that raised this error- Returns:
- the tester that raised this error
-
getCode
Gets the code- Returns:
- the code
-
getUniqueCode
Get the unique code for this test. Used for ignore lists.- Returns:
- The unique code (generated with
tester.getClass().getName().hashCode() + code). - Since:
- 18636
-
isFixable
Returns true if the error can be fixed automatically- Returns:
- true if the error can be fixed
-
getFix
Fixes the error with the appropriate command- Returns:
- The command to fix the error
-
setSelected
Sets the selection flag of this error- Parameters:
selected- if this error is selected
-
visitHighlighted
Visits all highlighted validation elements- Parameters:
v- The visitor that should receive a visit-notification on all highlighted elements
-
getHiliteNodesForArea
Calculate list of node pairs describing the area.- Parameters:
area- the area- Returns:
- list of node pairs describing the area
-
isSelected
Returns the selection flag of this error- Returns:
- true if this error is selected
- Since:
- 5671
-
getHighlighted
Returns The primitives or way segments to be highlighted- Returns:
- The primitives or way segments to be highlighted
- Since:
- 5671
-
compareTo
- Specified by:
compareToin interfaceComparable<TestError>
-
getNameVisitor
Returns a newMultipleNameVisitorfor the list of primitives affected by this error.- Returns:
- Name visitor (used in cell renderer and for sorting)
-
isSimilar
Tests if two errors are similar, i.e., same code and description and same combination of primitives and same combination of highlighted objects, but maybe with different orders.- Parameters:
other- the other error to be compared- Returns:
- true if two errors are similar
-
highlightedIsEqual
-
toString
-
isConcerned
Check if any of the primitives in this error occurs in the given set of primitives.- Parameters:
given- the set of primitives- Returns:
- true if any of the primitives in this error occurs in the given set of primitives, else false
- Since:
- 18960
-