Ignore:
Timestamp:
2018-08-05T21:43:31+02:00 (6 years ago)
Author:
Don-vip
Message:

drop unitils library. It was only added to avoid implementing hashCode/equals in template engine and search classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java

    r13887 r14093  
    322322            return match;
    323323        }
     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        }
    324344    }
    325345
     
    361381            return '(' + m.toString() + ')';
    362382        }
     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        }
    363412    }
    364413
     
    435484        public String toString() {
    436485            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;
    437512        }
    438513    }
     
    700775            return key + '=' + value;
    701776        }
     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        }
    702821    }
    703822
     
    747866        public String toString() {
    748867            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;
    749906        }
    750907    }
     
    8831040            return key + '=' + value;
    8841041        }
     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        }
    8851086    }
    8861087
     
    9541155            return search;
    9551156        }
     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        }
    9561189    }
    9571190
     
    9731206        public String toString() {
    9741207            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;
    9751225        }
    9761226    }
     
    10011251        public String toString() {
    10021252            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;
    10031273        }
    10041274    }
     
    10371307        public String toString() {
    10381308            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;
    10391329        }
    10401330    }
     
    10851375            return "Nth{nth=" + nth + ", modulo=" + modulo + '}';
    10861376        }
     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        }
    10871400    }
    10881401
     
    11201433        public String toString() {
    11211434            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;
    11221458        }
    11231459    }
     
    12371573        public boolean match(OsmPrimitive osm) {
    12381574            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;
    12391595        }
    12401596    }
     
    14901846                return false;
    14911847        }
     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        }
    14921865    }
    14931866
     
    15991972                return false;
    16001973            }
     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;
    16011994        }
    16021995    }
Note: See TracChangeset for help on using the changeset viewer.