Changeset 12667 in josm for trunk/src/org/openstreetmap/josm/data/validation
- Timestamp:
- 2017-08-26T21:28:55+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r12649 r12667 17 17 import java.util.Collection; 18 18 import java.util.Collections; 19 import java.util.EnumMap; 19 20 import java.util.HashMap; 21 import java.util.List; 20 22 import java.util.Map; 21 23 import java.util.SortedMap; 22 24 import java.util.TreeMap; 23 25 import java.util.TreeSet; 26 import java.util.function.Predicate; 27 import java.util.stream.Collectors; 24 28 25 29 import javax.swing.JOptionPane; … … 62 66 import org.openstreetmap.josm.gui.layer.ValidatorLayer; 63 67 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 68 import org.openstreetmap.josm.tools.AlphanumComparator; 64 69 import org.openstreetmap.josm.tools.Logging; 65 70 import org.openstreetmap.josm.tools.Utils; … … 389 394 } 390 395 396 /** 397 * Groups the given collection of errors by severity, then message, then description. 398 * @param errors list of errors to group 399 * @param filterToUse optional filter 400 * @return collection of errors grouped by severity, then message, then description 401 * @since 12667 402 */ 403 public static Map<Severity, Map<String, Map<String, List<TestError>>>> getErrorsBySeverityMessageDescription( 404 Collection<TestError> errors, Predicate<? super TestError> filterToUse) { 405 return errors.stream().filter(filterToUse).collect( 406 Collectors.groupingBy(TestError::getSeverity, () -> new EnumMap<>(Severity.class), 407 Collectors.groupingBy(TestError::getMessage, () -> new TreeMap<>(AlphanumComparator.getInstance()), 408 Collectors.groupingBy(e -> e.getDescription() == null ? "" : e.getDescription(), 409 () -> new TreeMap<>(AlphanumComparator.getInstance()), 410 Collectors.toList() 411 )))); 412 } 391 413 } -
trunk/src/org/openstreetmap/josm/data/validation/Severity.java
r12620 r12667 14 14 // CHECKSTYLE.OFF: SingleSpaceSeparator 15 15 /** Error messages */ 16 ERROR(tr("Errors"), /* ICON(data/) */"error", new ColorProperty(marktr("validation error"), Color.RED).get()), 16 ERROR(1, tr("Errors"), /* ICON(data/) */"error", new ColorProperty(marktr("validation error"), Color.RED).get()), 17 17 /** Warning messages */ 18 WARNING(tr("Warnings"), /* ICON(data/) */"warning", new ColorProperty(marktr("validation warning"), Color.YELLOW).get()), 18 WARNING(2, tr("Warnings"), /* ICON(data/) */"warning", new ColorProperty(marktr("validation warning"), Color.YELLOW).get()), 19 19 /** Other messages */ 20 OTHER(tr("Other"), /* ICON(data/) */"other", new ColorProperty(marktr("validation other"), Color.CYAN).get()); 20 OTHER(3, tr("Other"), /* ICON(data/) */"other", new ColorProperty(marktr("validation other"), Color.CYAN).get()); 21 21 // CHECKSTYLE.ON: SingleSpaceSeparator 22 23 /** Numeric ordering of the severities, 1 being major, 3 being minor */ 24 private final int level; 22 25 23 26 /** Description of the severity code */ … … 33 36 * Constructor 34 37 * 38 * @param level Numeric ordering, 1 being major, 3 being minor 35 39 * @param message Description 36 40 * @param icon Associated icon 37 41 * @param color The color of this severity 38 42 */ 39 Severity(String message, String icon, Color color) { 43 Severity(int level, String message, String icon, Color color) { 44 this.level = level; 40 45 this.message = message; 41 46 this.icon = icon; … … 72 77 return color; 73 78 } 79 80 /** 81 * Gets the severity level, 1 being major, 3 being minor 82 * @return The severity level 83 * @since 12667 84 */ 85 public int getLevel() { 86 return level; 87 } 74 88 } -
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r12656 r12667 39 39 * @author frsantos 40 40 */ 41 public class Test extends AbstractVisitor { 41 public class Test extends AbstractVisitor implements Comparable<Test> { 42 42 43 43 protected static final Predicate<OsmPrimitive> IN_DOWNLOADED_AREA = new NotOutsideDataSourceArea(); … … 359 359 Objects.equals(description, test.description); 360 360 } 361 362 @Override 363 public int compareTo(Test t) { 364 return name.compareTo(t.name); 365 } 361 366 }
Note:
See TracChangeset
for help on using the changeset viewer.