Changeset 14093 in josm for trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
- Timestamp:
- 2018-08-05T21:43:31+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
r13887 r14093 322 322 return match; 323 323 } 324 325 @Override 326 public int hashCode() { 327 return 31 + ((match == null) ? 0 : match.hashCode()); 328 } 329 330 @Override 331 public boolean equals(Object obj) { 332 if (this == obj) 333 return true; 334 if (obj == null || getClass() != obj.getClass()) 335 return false; 336 UnaryMatch other = (UnaryMatch) obj; 337 if (match == null) { 338 if (other.match != null) 339 return false; 340 } else if (!match.equals(other.match)) 341 return false; 342 return true; 343 } 324 344 } 325 345 … … 361 381 return '(' + m.toString() + ')'; 362 382 } 383 384 @Override 385 public int hashCode() { 386 final int prime = 31; 387 int result = 1; 388 result = prime * result + ((lhs == null) ? 0 : lhs.hashCode()); 389 result = prime * result + ((rhs == null) ? 0 : rhs.hashCode()); 390 return result; 391 } 392 393 @Override 394 public boolean equals(Object obj) { 395 if (this == obj) 396 return true; 397 if (obj == null || getClass() != obj.getClass()) 398 return false; 399 AbstractBinaryMatch other = (AbstractBinaryMatch) obj; 400 if (lhs == null) { 401 if (other.lhs != null) 402 return false; 403 } else if (!lhs.equals(other.lhs)) 404 return false; 405 if (rhs == null) { 406 if (other.rhs != null) 407 return false; 408 } else if (!rhs.equals(other.rhs)) 409 return false; 410 return true; 411 } 363 412 } 364 413 … … 435 484 public String toString() { 436 485 return key + '?'; 486 } 487 488 @Override 489 public int hashCode() { 490 final int prime = 31; 491 int result = 1; 492 result = prime * result + (defaultValue ? 1231 : 1237); 493 result = prime * result + ((key == null) ? 0 : key.hashCode()); 494 return result; 495 } 496 497 @Override 498 public boolean equals(Object obj) { 499 if (this == obj) 500 return true; 501 if (obj == null || getClass() != obj.getClass()) 502 return false; 503 BooleanMatch other = (BooleanMatch) obj; 504 if (defaultValue != other.defaultValue) 505 return false; 506 if (key == null) { 507 if (other.key != null) 508 return false; 509 } else if (!key.equals(other.key)) 510 return false; 511 return true; 437 512 } 438 513 } … … 700 775 return key + '=' + value; 701 776 } 777 778 @Override 779 public int hashCode() { 780 final int prime = 31; 781 int result = 1; 782 result = prime * result + (caseSensitive ? 1231 : 1237); 783 result = prime * result + ((key == null) ? 0 : key.hashCode()); 784 result = prime * result + ((keyPattern == null) ? 0 : keyPattern.hashCode()); 785 result = prime * result + ((value == null) ? 0 : value.hashCode()); 786 result = prime * result + ((valuePattern == null) ? 0 : valuePattern.hashCode()); 787 return result; 788 } 789 790 @Override 791 public boolean equals(Object obj) { 792 if (this == obj) 793 return true; 794 if (obj == null || getClass() != obj.getClass()) 795 return false; 796 KeyValue other = (KeyValue) obj; 797 if (caseSensitive != other.caseSensitive) 798 return false; 799 if (key == null) { 800 if (other.key != null) 801 return false; 802 } else if (!key.equals(other.key)) 803 return false; 804 if (keyPattern == null) { 805 if (other.keyPattern != null) 806 return false; 807 } else if (!keyPattern.equals(other.keyPattern)) 808 return false; 809 if (value == null) { 810 if (other.value != null) 811 return false; 812 } else if (!value.equals(other.value)) 813 return false; 814 if (valuePattern == null) { 815 if (other.valuePattern != null) 816 return false; 817 } else if (!valuePattern.equals(other.valuePattern)) 818 return false; 819 return true; 820 } 702 821 } 703 822 … … 747 866 public String toString() { 748 867 return key + (compareMode == -1 ? "<" : compareMode == +1 ? ">" : "") + referenceValue; 868 } 869 870 @Override 871 public int hashCode() { 872 final int prime = 31; 873 int result = 1; 874 result = prime * result + compareMode; 875 result = prime * result + ((key == null) ? 0 : key.hashCode()); 876 result = prime * result + ((referenceNumber == null) ? 0 : referenceNumber.hashCode()); 877 result = prime * result + ((referenceValue == null) ? 0 : referenceValue.hashCode()); 878 return result; 879 } 880 881 @Override 882 public boolean equals(Object obj) { 883 if (this == obj) 884 return true; 885 if (obj == null || getClass() != obj.getClass()) 886 return false; 887 ValueComparison other = (ValueComparison) obj; 888 if (compareMode != other.compareMode) 889 return false; 890 if (key == null) { 891 if (other.key != null) 892 return false; 893 } else if (!key.equals(other.key)) 894 return false; 895 if (referenceNumber == null) { 896 if (other.referenceNumber != null) 897 return false; 898 } else if (!referenceNumber.equals(other.referenceNumber)) 899 return false; 900 if (referenceValue == null) { 901 if (other.referenceValue != null) 902 return false; 903 } else if (!referenceValue.equals(other.referenceValue)) 904 return false; 905 return true; 749 906 } 750 907 } … … 883 1040 return key + '=' + value; 884 1041 } 1042 1043 @Override 1044 public int hashCode() { 1045 final int prime = 31; 1046 int result = 1; 1047 result = prime * result + ((key == null) ? 0 : key.hashCode()); 1048 result = prime * result + ((keyPattern == null) ? 0 : keyPattern.hashCode()); 1049 result = prime * result + ((mode == null) ? 0 : mode.hashCode()); 1050 result = prime * result + ((value == null) ? 0 : value.hashCode()); 1051 result = prime * result + ((valuePattern == null) ? 0 : valuePattern.hashCode()); 1052 return result; 1053 } 1054 1055 @Override 1056 public boolean equals(Object obj) { 1057 if (this == obj) 1058 return true; 1059 if (obj == null || getClass() != obj.getClass()) 1060 return false; 1061 ExactKeyValue other = (ExactKeyValue) obj; 1062 if (key == null) { 1063 if (other.key != null) 1064 return false; 1065 } else if (!key.equals(other.key)) 1066 return false; 1067 if (keyPattern == null) { 1068 if (other.keyPattern != null) 1069 return false; 1070 } else if (!keyPattern.equals(other.keyPattern)) 1071 return false; 1072 if (mode != other.mode) 1073 return false; 1074 if (value == null) { 1075 if (other.value != null) 1076 return false; 1077 } else if (!value.equals(other.value)) 1078 return false; 1079 if (valuePattern == null) { 1080 if (other.valuePattern != null) 1081 return false; 1082 } else if (!valuePattern.equals(other.valuePattern)) 1083 return false; 1084 return true; 1085 } 885 1086 } 886 1087 … … 954 1155 return search; 955 1156 } 1157 1158 @Override 1159 public int hashCode() { 1160 final int prime = 31; 1161 int result = 1; 1162 result = prime * result + (caseSensitive ? 1231 : 1237); 1163 result = prime * result + ((search == null) ? 0 : search.hashCode()); 1164 result = prime * result + ((searchRegex == null) ? 0 : searchRegex.hashCode()); 1165 return result; 1166 } 1167 1168 @Override 1169 public boolean equals(Object obj) { 1170 if (this == obj) 1171 return true; 1172 if (obj == null || getClass() != obj.getClass()) 1173 return false; 1174 Any other = (Any) obj; 1175 if (caseSensitive != other.caseSensitive) 1176 return false; 1177 if (search == null) { 1178 if (other.search != null) 1179 return false; 1180 } else if (!search.equals(other.search)) 1181 return false; 1182 if (searchRegex == null) { 1183 if (other.searchRegex != null) 1184 return false; 1185 } else if (!searchRegex.equals(other.searchRegex)) 1186 return false; 1187 return true; 1188 } 956 1189 } 957 1190 … … 973 1206 public String toString() { 974 1207 return "type=" + type; 1208 } 1209 1210 @Override 1211 public int hashCode() { 1212 return 31 + ((type == null) ? 0 : type.hashCode()); 1213 } 1214 1215 @Override 1216 public boolean equals(Object obj) { 1217 if (this == obj) 1218 return true; 1219 if (obj == null || getClass() != obj.getClass()) 1220 return false; 1221 ExactType other = (ExactType) obj; 1222 if (type != other.type) 1223 return false; 1224 return true; 975 1225 } 976 1226 } … … 1001 1251 public String toString() { 1002 1252 return "user=" + (user == null ? "" : user); 1253 } 1254 1255 @Override 1256 public int hashCode() { 1257 return 31 + ((user == null) ? 0 : user.hashCode()); 1258 } 1259 1260 @Override 1261 public boolean equals(Object obj) { 1262 if (this == obj) 1263 return true; 1264 if (obj == null || getClass() != obj.getClass()) 1265 return false; 1266 UserMatch other = (UserMatch) obj; 1267 if (user == null) { 1268 if (other.user != null) 1269 return false; 1270 } else if (!user.equals(other.user)) 1271 return false; 1272 return true; 1003 1273 } 1004 1274 } … … 1037 1307 public String toString() { 1038 1308 return "role=" + role; 1309 } 1310 1311 @Override 1312 public int hashCode() { 1313 return 31 + ((role == null) ? 0 : role.hashCode()); 1314 } 1315 1316 @Override 1317 public boolean equals(Object obj) { 1318 if (this == obj) 1319 return true; 1320 if (obj == null || getClass() != obj.getClass()) 1321 return false; 1322 RoleMatch other = (RoleMatch) obj; 1323 if (role == null) { 1324 if (other.role != null) 1325 return false; 1326 } else if (!role.equals(other.role)) 1327 return false; 1328 return true; 1039 1329 } 1040 1330 } … … 1085 1375 return "Nth{nth=" + nth + ", modulo=" + modulo + '}'; 1086 1376 } 1377 1378 @Override 1379 public int hashCode() { 1380 final int prime = 31; 1381 int result = 1; 1382 result = prime * result + (modulo ? 1231 : 1237); 1383 result = prime * result + nth; 1384 return result; 1385 } 1386 1387 @Override 1388 public boolean equals(Object obj) { 1389 if (this == obj) 1390 return true; 1391 if (obj == null || getClass() != obj.getClass()) 1392 return false; 1393 Nth other = (Nth) obj; 1394 if (modulo != other.modulo) 1395 return false; 1396 if (nth != other.nth) 1397 return false; 1398 return true; 1399 } 1087 1400 } 1088 1401 … … 1120 1433 public String toString() { 1121 1434 return getString() + '=' + min + '-' + max; 1435 } 1436 1437 @Override 1438 public int hashCode() { 1439 final int prime = 31; 1440 int result = 1; 1441 result = prime * result + (int) (max ^ (max >>> 32)); 1442 result = prime * result + (int) (min ^ (min >>> 32)); 1443 return result; 1444 } 1445 1446 @Override 1447 public boolean equals(Object obj) { 1448 if (this == obj) 1449 return true; 1450 if (obj == null || getClass() != obj.getClass()) 1451 return false; 1452 RangeMatch other = (RangeMatch) obj; 1453 if (max != other.max) 1454 return false; 1455 if (min != other.min) 1456 return false; 1457 return true; 1122 1458 } 1123 1459 } … … 1237 1573 public boolean match(OsmPrimitive osm) { 1238 1574 return osm instanceof Relation && ((Relation) osm).getMemberRoles().contains(role); 1575 } 1576 1577 @Override 1578 public int hashCode() { 1579 return 31 + ((role == null) ? 0 : role.hashCode()); 1580 } 1581 1582 @Override 1583 public boolean equals(Object obj) { 1584 if (this == obj) 1585 return true; 1586 if (obj == null || getClass() != obj.getClass()) 1587 return false; 1588 HasRole other = (HasRole) obj; 1589 if (role == null) { 1590 if (other.role != null) 1591 return false; 1592 } else if (!role.equals(other.role)) 1593 return false; 1594 return true; 1239 1595 } 1240 1596 } … … 1490 1846 return false; 1491 1847 } 1848 1849 @Override 1850 public int hashCode() { 1851 return 31 + (all ? 1231 : 1237); 1852 } 1853 1854 @Override 1855 public boolean equals(Object obj) { 1856 if (this == obj) 1857 return true; 1858 if (obj == null || getClass() != obj.getClass()) 1859 return false; 1860 InArea other = (InArea) obj; 1861 if (all != other.all) 1862 return false; 1863 return true; 1864 } 1492 1865 } 1493 1866 … … 1599 1972 return false; 1600 1973 } 1974 } 1975 1976 @Override 1977 public int hashCode() { 1978 return 31 + ((presets == null) ? 0 : presets.hashCode()); 1979 } 1980 1981 @Override 1982 public boolean equals(Object obj) { 1983 if (this == obj) 1984 return true; 1985 if (obj == null || getClass() != obj.getClass()) 1986 return false; 1987 Preset other = (Preset) obj; 1988 if (presets == null) { 1989 if (other.presets != null) 1990 return false; 1991 } else if (!presets.equals(other.presets)) 1992 return false; 1993 return true; 1601 1994 } 1602 1995 }
Note:
See TracChangeset
for help on using the changeset viewer.