Changeset 6591 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-01-01T14:56:22+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r6400 r6591 88 88 89 89 /** 90 * A test that forwards all primitives to {@link #check(OsmPrimitive)}. 91 */ 92 public static abstract class TagTest extends Test { 93 public TagTest(String name, String description) { 94 super(name, description); 95 } 96 97 public TagTest(String name) { 98 super(name); 99 } 100 101 public abstract void check(final OsmPrimitive p); 102 103 @Override 104 public void visit(Node n) { 105 check(n); 106 } 107 108 @Override 109 public void visit(Way w) { 110 check(w); 111 } 112 113 @Override 114 public void visit(Relation r) { 115 check(r); 116 } 117 } 118 119 /** 90 120 * Initializes any global data used this tester. 91 121 * @throws Exception When cannot initialize the test -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r6584 r6591 56 56 * @since 6506 57 57 */ 58 public class MapCSSTagChecker extends Test {58 public class MapCSSTagChecker extends Test.TagTest { 59 59 60 60 /** … … 338 338 * @param p The primitive to inspect. 339 339 */ 340 public void visit(OsmPrimitive p) { 340 @Override 341 public void check(OsmPrimitive p) { 341 342 for (TagCheck check : checks) { 342 343 final TestError error = check.getErrorForPrimitive(p); … … 346 347 } 347 348 } 348 }349 350 @Override351 public void visit(Node n) {352 visit((OsmPrimitive) n);353 }354 355 @Override356 public void visit(Way w) {357 visit((OsmPrimitive) w);358 }359 360 @Override361 public void visit(Relation r) {362 visit((OsmPrimitive) r);363 349 } 364 350 -
trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java
r6494 r6591 29 29 * @author Skela 30 30 */ 31 public class NameMismatch extends Test {31 public class NameMismatch extends Test.TagTest { 32 32 protected static final int NAME_MISSING = 1501; 33 33 protected static final int NAME_TRANSLATION_MISSING = 1502; … … 57 57 * @param p The primitive to be tested 58 58 */ 59 @Override 59 60 public void check(OsmPrimitive p) { 60 61 HashSet<String> names = new HashSet<String>(); … … 100 101 } 101 102 } 102 103 /**104 * Checks a name mismatch in all primitives.105 *106 * @param selection The primitives to be tested107 */108 @Override109 public void visit(Collection<OsmPrimitive> selection) {110 for (OsmPrimitive p : selection) {111 if (!p.isDeleted() && !p.isIncomplete()) {112 check(p);113 }114 }115 }116 103 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r6568 r6591 35 35 * @since 6370 36 36 */ 37 public class OpeningHourTest extends Test {37 public class OpeningHourTest extends Test.TagTest { 38 38 39 39 /** … … 222 222 } 223 223 224 protected void check(final OsmPrimitive p) { 224 @Override 225 public void check(final OsmPrimitive p) { 225 226 check(p, "opening_hours", CheckMode.TIME_RANGE); 226 227 check(p, "collection_times", CheckMode.BOTH); 227 228 check(p, "service_times", CheckMode.BOTH); 228 229 } 229 230 @Override231 public void visit(final Node n) {232 check(n);233 }234 235 @Override236 public void visit(final Relation r) {237 check(r);238 }239 240 @Override241 public void visit(final Way w) {242 check(w);243 }244 230 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r6553 r6591 66 66 * @author frsantos 67 67 */ 68 public class TagChecker extends Test {68 public class TagChecker extends Test.TagTest { 69 69 70 70 /** The default data file of tagchecker rules */ … … 317 317 } 318 318 319 @Override320 public void visit(Node n) {321 checkPrimitive(n);322 }323 324 @Override325 public void visit(Relation n) {326 checkPrimitive(n);327 }328 329 @Override330 public void visit(Way w) {331 checkPrimitive(w);332 }333 334 319 /** 335 320 * Checks given string (key or value) if it contains characters with code below 0x20 (either newline or some other special characters) … … 350 335 * @param p The primitive to check 351 336 */ 352 private void checkPrimitive(OsmPrimitive p) { 337 @Override 338 public void check(OsmPrimitive p) { 353 339 // Just a collection to know if a primitive has been already marked with error 354 340 MultiMap<OsmPrimitive, String> withErrors = new MultiMap<OsmPrimitive, String>();
Note:
See TracChangeset
for help on using the changeset viewer.