Changeset 15463 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2019-10-19T08:08:54+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r15121 r15463 8 8 import java.util.Collection; 9 9 import java.util.List; 10 import java.util.Objects;11 10 import java.util.Optional; 12 11 import java.util.function.Predicate; … … 39 38 * @author frsantos 40 39 */ 41 public class Test implements OsmPrimitiveVisitor , Comparable<Test>{40 public class Test implements OsmPrimitiveVisitor { 42 41 43 42 protected static final Predicate<OsmPrimitive> IN_DOWNLOADED_AREA = new NotOutsideDataSourceArea(); … … 365 364 } 366 365 367 @Override368 public int hashCode() {369 return Objects.hash(name, description);370 }371 372 @Override373 public boolean equals(Object obj) {374 if (this == obj) return true;375 if (obj == null || getClass() != obj.getClass()) return false;376 Test test = (Test) obj;377 return Objects.equals(name, test.name) &&378 Objects.equals(description, test.description);379 }380 381 @Override382 public int compareTo(Test t) {383 return name.compareTo(t.name);384 }385 386 366 /** 387 367 * Free resources. -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r15417 r15463 682 682 683 683 @Override 684 public synchronized boolean equals(Object obj) {685 return super.equals(obj)686 || (obj instanceof TagCheck && rule.equals(((TagCheck) obj).rule))687 || (obj instanceof GroupedMapCSSRule && rule.equals(obj));688 }689 690 @Override691 public synchronized int hashCode() {692 return Objects.hash(super.hashCode(), rule);693 }694 695 @Override696 684 public String toString() { 697 685 return "MapCSSTagCheckerAndRule [rule=" + rule + ']'; … … 930 918 final Collection<TestError> pErrors = getErrorsForPrimitive(p, true, checksToRun); 931 919 Logging.debug("- Errors: {0}", pErrors); 932 @SuppressWarnings({"EqualsBetweenInconvertibleTypes", "EqualsIncompatibleType"})933 final boolean isError = pErrors.stream().anyMatch(e -> e.getTester().equals(check.rule));920 final boolean isError = pErrors.stream().anyMatch(e -> e.getTester() instanceof MapCSSTagCheckerAndRule 921 && ((MapCSSTagCheckerAndRule) e.getTester()).rule.equals(check.rule)); 934 922 if (isError != i.getValue()) { 935 923 assertionErrors.add(MessageFormat.format("Expecting test ''{0}'' (i.e., {1}) to {2} {3} (i.e., {4})", … … 957 945 } 958 946 ds.addPrimitive(p); 959 }960 961 @Override962 public synchronized int hashCode() {963 return Objects.hash(super.hashCode(), checks);964 }965 966 @Override967 public synchronized boolean equals(Object obj) {968 if (this == obj) return true;969 if (obj == null || getClass() != obj.getClass()) return false;970 if (!super.equals(obj)) return false;971 MapCSSTagChecker that = (MapCSSTagChecker) obj;972 return Objects.equals(checks, that.checks);973 947 } 974 948 -
trunk/src/org/openstreetmap/josm/data/validation/tests/SharpAngles.java
r15448 r15463 6 6 import java.util.Arrays; 7 7 import java.util.Collection; 8 import java.util.Objects;9 8 import java.util.TreeSet; 10 9 … … 152 151 } 153 152 154 @Override155 public int hashCode() {156 return 31 * super.hashCode() + Objects.hash(ignoreHighways, maxAngle, maxLength);157 }158 159 @Override160 public boolean equals(Object obj) {161 if (this == obj)162 return true;163 if (!super.equals(obj) || getClass() != obj.getClass())164 return false;165 SharpAngles other = (SharpAngles) obj;166 return Objects.equals(ignoreHighways, other.ignoreHighways)167 && Double.doubleToLongBits(maxAngle) == Double.doubleToLongBits(other.maxAngle)168 && Double.doubleToLongBits(maxLength) == Double.doubleToLongBits(other.maxLength);169 }170 153 }
Note:
See TracChangeset
for help on using the changeset viewer.