1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.validation;
|
---|
3 |
|
---|
4 | import java.util.Collection;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.command.Command;
|
---|
7 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Validation error easily fixable right at its detection. The fix can be given when constructing the error.
|
---|
11 | * @since 6377
|
---|
12 | */
|
---|
13 | public class FixableTestError extends TestError {
|
---|
14 | protected final Command fix;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Constructs a new {@code FixableTestError} for a single primitive.
|
---|
18 | * @param tester The tester
|
---|
19 | * @param severity The severity of this error
|
---|
20 | * @param message The error message
|
---|
21 | * @param code The test error reference code
|
---|
22 | * @param primitive The affected primitive
|
---|
23 | * @param fix The command used to fix the error
|
---|
24 | */
|
---|
25 | public FixableTestError(Test tester, Severity severity, String message, int code, OsmPrimitive primitive, Command fix) {
|
---|
26 | super(tester, severity, message, code, primitive);
|
---|
27 | this.fix = fix;
|
---|
28 | }
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Constructs a new {@code FixableTestError} for multiple primitives.
|
---|
32 | * @param tester The tester
|
---|
33 | * @param severity The severity of this error
|
---|
34 | * @param message The error message
|
---|
35 | * @param code The test error reference code
|
---|
36 | * @param primitives The affected primitives
|
---|
37 | * @param fix The command used to fix the error
|
---|
38 | */
|
---|
39 | public FixableTestError(Test tester, Severity severity, String message, int code, Collection<? extends OsmPrimitive> primitives,
|
---|
40 | Command fix) {
|
---|
41 | super(tester, severity, message, code, primitives);
|
---|
42 | this.fix = fix;
|
---|
43 | }
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Constructs a new {@code FixableTestError} for multiple primitives.
|
---|
47 | * @param tester The tester
|
---|
48 | * @param severity The severity of this error
|
---|
49 | * @param message The error message
|
---|
50 | * @param code The test error reference code
|
---|
51 | * @param primitives The affected primitives
|
---|
52 | * @param highlighted OSM primitives to highlight
|
---|
53 | * @param fix The command used to fix the error
|
---|
54 | */
|
---|
55 | public FixableTestError(Test tester, Severity severity, String message, int code, Collection<? extends OsmPrimitive> primitives,
|
---|
56 | Collection<?> highlighted, Command fix) {
|
---|
57 | super(tester, severity, message, code, primitives, highlighted);
|
---|
58 | this.fix = fix;
|
---|
59 | }
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Constructs a new {@code FixableTestError} for a single primitive.
|
---|
63 | * @param tester The tester
|
---|
64 | * @param severity The severity of this error
|
---|
65 | * @param message The error message
|
---|
66 | * @param description The translated description
|
---|
67 | * @param descriptionEn The English description
|
---|
68 | * @param code The test error reference code
|
---|
69 | * @param primitive The affected primitive
|
---|
70 | * @param fix The command used to fix the error
|
---|
71 | */
|
---|
72 | public FixableTestError(Test tester, Severity severity, String message, String description, String descriptionEn, int code,
|
---|
73 | OsmPrimitive primitive, Command fix) {
|
---|
74 | super(tester, severity, message, description, descriptionEn, code, primitive);
|
---|
75 | this.fix = fix;
|
---|
76 | }
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Constructs a new {@code FixableTestError} for multiple primitives.
|
---|
80 | * @param tester The tester
|
---|
81 | * @param severity The severity of this error
|
---|
82 | * @param message The error message
|
---|
83 | * @param description The translated description
|
---|
84 | * @param descriptionEn The English description
|
---|
85 | * @param code The test error reference code
|
---|
86 | * @param primitives The affected primitives
|
---|
87 | * @param fix The command used to fix the error
|
---|
88 | */
|
---|
89 | public FixableTestError(Test tester, Severity severity, String message, String description, String descriptionEn, int code,
|
---|
90 | Collection<? extends OsmPrimitive> primitives, Command fix) {
|
---|
91 | super(tester, severity, message, description, descriptionEn, code, primitives);
|
---|
92 | this.fix = fix;
|
---|
93 | }
|
---|
94 |
|
---|
95 | /**
|
---|
96 | * Constructs a new {@code FixableTestError} for multiple primitives.
|
---|
97 | * @param tester The tester
|
---|
98 | * @param severity The severity of this error
|
---|
99 | * @param message The error message
|
---|
100 | * @param description The translated description
|
---|
101 | * @param descriptionEn The English description
|
---|
102 | * @param code The test error reference code
|
---|
103 | * @param primitives The affected primitives
|
---|
104 | * @param highlighted OSM primitives to highlight
|
---|
105 | * @param fix The command used to fix the error
|
---|
106 | */
|
---|
107 | public FixableTestError(Test tester, Severity severity, String message, String description, String descriptionEn, int code,
|
---|
108 | Collection<? extends OsmPrimitive> primitives, Collection<?> highlighted, Command fix) {
|
---|
109 | super(tester, severity, message, description, descriptionEn, code, primitives, highlighted);
|
---|
110 | this.fix = fix;
|
---|
111 | }
|
---|
112 |
|
---|
113 | @Override
|
---|
114 | public Command getFix() {
|
---|
115 | return fix;
|
---|
116 | }
|
---|
117 |
|
---|
118 | @Override
|
---|
119 | public final boolean isFixable() {
|
---|
120 | return true;
|
---|
121 | }
|
---|
122 | }
|
---|