Changeset 9371 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2016-01-09T23:20:37+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecision.java
r9078 r9371 4 4 import static org.openstreetmap.josm.gui.conflict.tags.RelationMemberConflictDecisionType.UNDECIDED; 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 7 import java.util.Objects; 6 8 7 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 72 74 @Override 73 75 public int hashCode() { 74 final int prime = 31; 75 int result = 1; 76 result = prime * result + ((decision == null) ? 0 : decision.hashCode()); 77 result = prime * result + ((originalPrimitive == null) ? 0 : originalPrimitive.hashCode()); 78 result = prime * result + pos; 79 result = prime * result + ((relation == null) ? 0 : relation.hashCode()); 80 result = prime * result + ((role == null) ? 0 : role.hashCode()); 81 return result; 76 return Objects.hash(relation, pos, originalPrimitive, role, decision); 82 77 } 83 78 84 79 @Override 85 80 public boolean equals(Object obj) { 86 if (this == obj) 87 return true; 88 if (obj == null) 89 return false; 90 if (getClass() != obj.getClass()) 91 return false; 92 RelationMemberConflictDecision other = (RelationMemberConflictDecision) obj; 93 if (decision == null) { 94 if (other.decision != null) 95 return false; 96 } else if (!decision.equals(other.decision)) 97 return false; 98 if (originalPrimitive == null) { 99 if (other.originalPrimitive != null) 100 return false; 101 } else if (!originalPrimitive.equals(other.originalPrimitive)) 102 return false; 103 if (pos != other.pos) 104 return false; 105 if (relation == null) { 106 if (other.relation != null) 107 return false; 108 } else if (!relation.equals(other.relation)) 109 return false; 110 if (role == null) { 111 if (other.role != null) 112 return false; 113 } else if (!role.equals(other.role)) 114 return false; 115 return true; 81 if (this == obj) return true; 82 if (obj == null || getClass() != obj.getClass()) return false; 83 RelationMemberConflictDecision that = (RelationMemberConflictDecision) obj; 84 return pos == that.pos && 85 Objects.equals(relation, that.relation) && 86 Objects.equals(originalPrimitive, that.originalPrimitive) && 87 Objects.equals(role, that.role) && 88 decision == that.decision; 116 89 } 117 90 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java
r9246 r9371 54 54 @Override 55 55 public int hashCode() { 56 final int prime = 31; 57 int result = 1; 58 result = prime * result + ((layer == null) ? 0 : layer.hashCode()); 59 result = prime * result + ((relation == null) ? 0 : relation.hashCode()); 60 return result; 56 return Objects.hash(relation, layer); 61 57 } 62 58 63 59 @Override 64 60 public boolean equals(Object obj) { 65 if (this == obj) 66 return true; 67 if (obj == null) 68 return false; 69 if (getClass() != obj.getClass()) 70 return false; 71 DialogContext other = (DialogContext) obj; 72 if (layer == null) { 73 if (other.layer != null) 74 return false; 75 } else if (!layer.equals(other.layer)) 76 return false; 77 if (relation == null) { 78 if (other.relation != null) 79 return false; 80 } else if (!relation.equals(other.relation)) 81 return false; 82 return true; 61 if (this == obj) return true; 62 if (obj == null || getClass() != obj.getClass()) return false; 63 DialogContext that = (DialogContext) obj; 64 return Objects.equals(relation, that.relation) && 65 Objects.equals(layer, that.layer); 83 66 } 84 67 -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java
r8836 r9371 12 12 import java.util.List; 13 13 import java.util.Locale; 14 import java.util.Objects; 14 15 15 16 import javax.swing.DefaultListModel; … … 79 80 @Override 80 81 public int hashCode() { 81 final int prime = 31; 82 int result = 1; 83 result = prime * result + ((area == null) ? 0 : area.hashCode()); 84 result = prime * result + ((name == null) ? 0 : name.hashCode()); 85 return result; 82 return Objects.hash(name, area); 86 83 } 87 84 88 85 @Override 89 86 public boolean equals(Object obj) { 90 if (this == obj) 91 return true; 92 if (obj == null) 93 return false; 94 if (getClass() != obj.getClass()) 95 return false; 96 Bookmark other = (Bookmark) obj; 97 if (area == null) { 98 if (other.area != null) 99 return false; 100 } else if (!area.equals(other.area)) 101 return false; 102 if (name == null) { 103 if (other.name != null) 104 return false; 105 } else if (!name.equals(other.name)) 106 return false; 107 return true; 87 if (this == obj) return true; 88 if (obj == null || getClass() != obj.getClass()) return false; 89 Bookmark bookmark = (Bookmark) obj; 90 return Objects.equals(name, bookmark.name) && 91 Objects.equals(area, bookmark.area); 108 92 } 109 93 -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySpecification.java
r8510 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.io; 3 4 import java.util.Objects; 3 5 4 6 /** … … 107 109 @Override 108 110 public int hashCode() { 109 final int prime = 31; 110 int result = 1; 111 result = prime * result + chunkSize; 112 result = prime * result + (closeChangesetAfterUpload ? 1231 : 1237); 113 result = prime * result + ((policy == null) ? 0 : policy.hashCode()); 114 result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); 115 return result; 111 return Objects.hash(strategy, chunkSize, policy, closeChangesetAfterUpload); 116 112 } 117 113 118 114 @Override 119 115 public boolean equals(Object obj) { 120 if (this == obj) 121 return true; 122 if (obj == null) 123 return false; 124 if (getClass() != obj.getClass()) 125 return false; 126 UploadStrategySpecification other = (UploadStrategySpecification) obj; 127 if (chunkSize != other.chunkSize) 128 return false; 129 if (closeChangesetAfterUpload != other.closeChangesetAfterUpload) 130 return false; 131 if (policy == null) { 132 if (other.policy != null) 133 return false; 134 } else if (!policy.equals(other.policy)) 135 return false; 136 if (strategy == null) { 137 if (other.strategy != null) 138 return false; 139 } else if (!strategy.equals(other.strategy)) 140 return false; 141 return true; 116 if (this == obj) return true; 117 if (obj == null || getClass() != obj.getClass()) return false; 118 UploadStrategySpecification that = (UploadStrategySpecification) obj; 119 return chunkSize == that.chunkSize && 120 closeChangesetAfterUpload == that.closeChangesetAfterUpload && 121 strategy == that.strategy && 122 policy == that.policy; 142 123 } 143 124 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/DividedScale.java
r9341 r9371 4 4 import java.util.ArrayList; 5 5 import java.util.List; 6 import java.util.Objects; 6 7 7 8 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; … … 176 177 @Override 177 178 public boolean equals(Object obj) { 178 if (obj == null || getClass() != obj.getClass()) 179 return false; 180 final DividedScale other = (DividedScale) obj; 181 return bd.equals(other.bd) && data.equals(other.data); 179 if (this == obj) return true; 180 if (obj == null || getClass() != obj.getClass()) return false; 181 DividedScale<?> that = (DividedScale<?>) obj; 182 return Objects.equals(bd, that.bd) && 183 Objects.equals(data, that.data); 182 184 } 183 185 184 186 @Override 185 187 public int hashCode() { 186 int hash = 7; 187 hash = 23 * hash + bd.hashCode(); 188 hash = 23 * hash + data.hashCode(); 189 return hash; 188 return Objects.hash(bd, data); 190 189 } 191 190 -
trunk/src/org/openstreetmap/josm/gui/mappaint/Keyword.java
r8404 r9371 19 19 @Override 20 20 public boolean equals(Object obj) { 21 if (obj == null || getClass() != obj.getClass()) 22 return false; 23 return Objects.equals(val, ((Keyword) obj).val); 21 if (this == obj) return true; 22 if (obj == null || getClass() != obj.getClass()) return false; 23 Keyword keyword = (Keyword) obj; 24 return Objects.equals(val, keyword.val); 24 25 } 25 26 26 27 @Override 27 28 public int hashCode() { 28 return val.hashCode();29 return Objects.hash(val); 29 30 } 30 31 -
trunk/src/org/openstreetmap/josm/gui/mappaint/Range.java
r9239 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint; 3 4 import java.util.Objects; 3 5 4 6 /** … … 91 93 if (this == o) return true; 92 94 if (o == null || getClass() != o.getClass()) return false; 93 94 95 Range range = (Range) o; 95 96 if (Double.compare(range.lower, lower) != 0) return false; 97 if (Double.compare(range.upper, upper) != 0) return false; 98 99 return true; 96 return Double.compare(range.lower, lower) == 0 && 97 Double.compare(range.upper, upper) == 0; 100 98 } 101 99 102 100 @Override 103 101 public int hashCode() { 104 int result; 105 long temp; 106 temp = Double.doubleToLongBits(lower); 107 result = (int) (temp ^ (temp >>> 32)); 108 temp = Double.doubleToLongBits(upper); 109 result = 31 * result + (int) (temp ^ (temp >>> 32)); 110 return result; 102 return Objects.hash(lower, upper); 111 103 } 112 104 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleElementList.java
r9284 r9371 57 57 @Override 58 58 public boolean equals(Object obj) { 59 if (obj == null || getClass() != obj.getClass()) { 60 return false; 61 } 62 final StyleElementList other = (StyleElementList) obj; 63 return Objects.equals(lst, other.lst); 59 if (this == obj) return true; 60 if (obj == null || getClass() != obj.getClass()) return false; 61 StyleElementList that = (StyleElementList) obj; 62 return Objects.equals(lst, that.lst); 64 63 } 65 64 66 65 @Override 67 66 public int hashCode() { 68 return lst.hashCode();67 return Objects.hash(lst); 69 68 } 70 71 69 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java
r8846 r9371 3 3 4 4 import java.util.List; 5 import java.util.Objects; 5 6 6 7 import org.openstreetmap.josm.gui.mappaint.Environment; … … 42 43 @Override 43 44 public int hashCode() { 44 final int prime = 31; 45 int result = 1; 46 result = prime * result + idx; 47 result = prime * result + ((instructions == null) ? 0 : instructions.hashCode()); 48 return result; 45 return Objects.hash(instructions, idx); 49 46 } 50 47 51 48 @Override 52 49 public boolean equals(Object obj) { 53 if (this == obj) 54 return true; 55 if (obj == null) 56 return false; 57 if (!(obj instanceof Declaration)) 58 return false; 59 Declaration other = (Declaration) obj; 60 if (idx != other.idx) 61 return false; 62 if (instructions == null) { 63 if (other.instructions != null) 64 return false; 65 } else if (!instructions.equals(other.instructions)) 66 return false; 67 return true; 50 if (this == obj) return true; 51 if (obj == null || getClass() != obj.getClass()) return false; 52 Declaration that = (Declaration) obj; 53 return idx == that.idx && 54 Objects.equals(instructions, that.instructions); 68 55 } 69 56 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
r9341 r9371 117 117 @Override 118 118 public boolean equals(Object obj) { 119 if (obj == null || getClass() != obj.getClass()) 120 return false; 121 if (!super.equals(obj)) 122 return false; 123 AreaElement other = (AreaElement) obj; 124 // we should get the same image object due to caching 125 if (!Objects.equals(fillImage, other.fillImage)) 126 return false; 127 if (!Objects.equals(color, other.color)) 128 return false; 129 if (!Objects.equals(extent, other.extent)) 130 return false; 131 if (!Objects.equals(extentThreshold, other.extentThreshold)) 132 return false; 133 if (!Objects.equals(text, other.text)) 134 return false; 135 return true; 119 if (this == obj) return true; 120 if (obj == null || getClass() != obj.getClass()) return false; 121 if (!super.equals(obj)) return false; 122 AreaElement that = (AreaElement) obj; 123 return Objects.equals(color, that.color) && 124 Objects.equals(fillImage, that.fillImage) && 125 Objects.equals(text, that.text) && 126 Objects.equals(extent, that.extent) && 127 Objects.equals(extentThreshold, that.extentThreshold); 136 128 } 137 129 138 130 @Override 139 131 public int hashCode() { 140 int hash = super.hashCode(); 141 hash = 61 * hash + color.hashCode(); 142 hash = 61 * hash + (extent != null ? Float.floatToIntBits(extent) : 0); 143 hash = 61 * hash + (extentThreshold != null ? Float.floatToIntBits(extentThreshold) : 0); 144 hash = 61 * hash + (fillImage != null ? fillImage.hashCode() : 0); 145 hash = 61 * hash + (text != null ? text.hashCode() : 0); 146 return hash; 132 return Objects.hash(super.hashCode(), color, fillImage, text, extent, extentThreshold); 147 133 } 148 134 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.java
r9278 r9371 4 4 import java.awt.Color; 5 5 import java.awt.Rectangle; 6 import java.util.Objects; 6 7 7 8 import org.openstreetmap.josm.data.osm.Node; … … 73 74 @Override 74 75 public int hashCode() { 75 return box.hashCode();76 return Objects.hash(box); 76 77 } 77 78 78 79 @Override 79 80 public boolean equals(Object obj) { 80 if (!(obj instanceof BoxProvider)) 81 return false; 82 final BoxProvider other = (BoxProvider) obj; 83 BoxProviderResult resultOther = other.get(); 84 if (resultOther.isTemporary()) return false; 85 return box.equals(resultOther.getBox()); 81 if (this == obj) return true; 82 if (obj == null || getClass() != obj.getClass()) return false; 83 SimpleBoxProvider that = (SimpleBoxProvider) obj; 84 return Objects.equals(box, that.box); 86 85 } 87 86 } … … 207 206 @Override 208 207 public boolean equals(Object obj) { 209 if (!super.equals(obj)) 210 return false; 211 if (obj == null || getClass() != obj.getClass()) 212 return false; 213 final BoxTextElement other = (BoxTextElement) obj; 214 if (!text.equals(other.text)) return false; 215 if (boxProvider != null) { 216 if (!boxProvider.equals(other.boxProvider)) return false; 217 } else if (other.boxProvider != null) 218 return false; 219 else { 220 if (!box.equals(other.box)) return false; 221 } 222 if (hAlign != other.hAlign) return false; 223 if (vAlign != other.vAlign) return false; 224 return true; 208 if (this == obj) return true; 209 if (obj == null || getClass() != obj.getClass()) return false; 210 if (!super.equals(obj)) return false; 211 BoxTextElement that = (BoxTextElement) obj; 212 return Objects.equals(text, that.text) && 213 Objects.equals(boxProvider, that.boxProvider) && 214 Objects.equals(box, that.box) && 215 hAlign == that.hAlign && 216 vAlign == that.vAlign; 225 217 } 226 218 227 219 @Override 228 220 public int hashCode() { 229 int hash = super.hashCode(); 230 hash = 97 * hash + text.hashCode(); 231 if (boxProvider != null) { 232 hash = 97 * hash + boxProvider.hashCode(); 233 } else { 234 hash = 97 * hash + box.hashCode(); 235 } 236 hash = 97 * hash + hAlign.hashCode(); 237 hash = 97 * hash + vAlign.hashCode(); 238 return hash; 221 return Objects.hash(super.hashCode(), text, boxProvider, box, hAlign, vAlign); 239 222 } 240 223 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java
r9278 r9371 6 6 import java.util.Collections; 7 7 import java.util.List; 8 import java.util.Objects; 8 9 9 10 import org.openstreetmap.josm.Main; … … 70 71 @Override 71 72 public int hashCode() { 72 final int prime = 31; 73 int result = 1; 74 result = prime * result + ((defaultLabel == null) ? 0 : defaultLabel.hashCode()); 75 return result; 73 return Objects.hash(defaultLabel); 76 74 } 77 75 78 76 @Override 79 77 public boolean equals(Object obj) { 80 if (this == obj) 81 return true; 82 if (obj == null) 83 return false; 84 if (getClass() != obj.getClass()) 85 return false; 86 StaticLabelCompositionStrategy other = (StaticLabelCompositionStrategy) obj; 87 if (defaultLabel == null) { 88 if (other.defaultLabel != null) 89 return false; 90 } else if (!defaultLabel.equals(other.defaultLabel)) 91 return false; 92 return true; 78 if (this == obj) return true; 79 if (obj == null || getClass() != obj.getClass()) return false; 80 StaticLabelCompositionStrategy that = (StaticLabelCompositionStrategy) obj; 81 return Objects.equals(defaultLabel, that.defaultLabel); 93 82 } 94 83 } … … 126 115 @Override 127 116 public int hashCode() { 128 final int prime = 31; 129 int result = 1; 130 result = prime * result + ((defaultLabelTag == null) ? 0 : defaultLabelTag.hashCode()); 131 return result; 117 return Objects.hash(defaultLabelTag); 132 118 } 133 119 134 120 @Override 135 121 public boolean equals(Object obj) { 136 if (this == obj) 137 return true; 138 if (obj == null) 139 return false; 140 if (getClass() != obj.getClass()) 141 return false; 142 TagLookupCompositionStrategy other = (TagLookupCompositionStrategy) obj; 143 if (defaultLabelTag == null) { 144 if (other.defaultLabelTag != null) 145 return false; 146 } else if (!defaultLabelTag.equals(other.defaultLabelTag)) 147 return false; 148 return true; 122 if (this == obj) return true; 123 if (obj == null || getClass() != obj.getClass()) return false; 124 TagLookupCompositionStrategy that = (TagLookupCompositionStrategy) obj; 125 return Objects.equals(defaultLabelTag, that.defaultLabelTag); 149 126 } 150 127 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.java
r9341 r9371 359 359 @Override 360 360 public int hashCode() { 361 int hash = super.hashCode(); 362 hash = 29 * hash + line.hashCode(); 363 hash = 29 * hash + color.hashCode(); 364 hash = 29 * hash + (dashesLine != null ? dashesLine.hashCode() : 0); 365 hash = 29 * hash + (dashesBackground != null ? dashesBackground.hashCode() : 0); 366 hash = 29 * hash + Float.floatToIntBits(offset); 367 hash = 29 * hash + Float.floatToIntBits(realWidth); 368 hash = 29 * hash + (this.wayDirectionArrows ? 1 : 0); 369 return hash; 361 return Objects.hash(super.hashCode(), line, color, dashesBackground, offset, realWidth, wayDirectionArrows, dashesLine); 370 362 } 371 363 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineTextElement.java
r9341 r9371 44 44 @Override 45 45 public boolean equals(Object obj) { 46 if (obj == null || getClass() != obj.getClass()) 47 return false; 48 if (!super.equals(obj)) 49 return false; 50 final LineTextElement other = (LineTextElement) obj; 51 return Objects.equals(text, other.text); 46 if (this == obj) return true; 47 if (obj == null || getClass() != obj.getClass()) return false; 48 if (!super.equals(obj)) return false; 49 LineTextElement that = (LineTextElement) obj; 50 return Objects.equals(text, that.text); 52 51 } 53 52 54 53 @Override 55 54 public int hashCode() { 56 int hash = super.hashCode(); 57 hash = 43 * hash + text.hashCode(); 58 return hash; 55 return Objects.hash(super.hashCode(), text); 59 56 } 60 57 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
r9334 r9371 217 217 @Override 218 218 public boolean equals(Object obj) { 219 if (obj == null || getClass() != obj.getClass()) 220 return false; 221 final MapImage other = (MapImage) obj; 222 // img changes when image is fully loaded and can't be used for equality check. 223 return alpha == other.alpha && 224 Objects.equals(name, other.name) && 225 Objects.equals(source, other.source) && 226 autoRescale == other.autoRescale && 227 width == other.width && 228 height == other.height; 219 if (this == obj) return true; 220 if (obj == null || getClass() != obj.getClass()) return false; 221 MapImage mapImage = (MapImage) obj; 222 return alpha == mapImage.alpha && 223 autoRescale == mapImage.autoRescale && 224 width == mapImage.width && 225 height == mapImage.height && 226 Objects.equals(name, mapImage.name) && 227 Objects.equals(source, mapImage.source); 229 228 } 230 229 231 230 @Override 232 231 public int hashCode() { 233 int hash = 7; 234 hash = 67 * hash + alpha; 235 hash = 67 * hash + name.hashCode(); 236 hash = 67 * hash + source.hashCode(); 237 hash = 67 * hash + (autoRescale ? 1 : 0); 238 hash = 67 * hash + width; 239 hash = 67 * hash + height; 240 return hash; 232 return Objects.hash(alpha, name, source, autoRescale, width, height); 241 233 } 242 234 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r9341 r9371 68 68 @Override 69 69 public int hashCode() { 70 int hash = 7; 71 hash = 67 * hash + symbol.hashCode(); 72 hash = 67 * hash + size; 73 hash = 67 * hash + (stroke != null ? stroke.hashCode() : 0); 74 hash = 67 * hash + (strokeColor != null ? strokeColor.hashCode() : 0); 75 hash = 67 * hash + (fillColor != null ? fillColor.hashCode() : 0); 76 return hash; 70 return Objects.hash(symbol, size, stroke, strokeColor, fillColor); 77 71 } 78 72 … … 364 358 @Override 365 359 public int hashCode() { 366 int hash = super.hashCode(); 367 hash = 17 * hash + (mapImage != null ? mapImage.hashCode() : 0); 368 hash = 17 * hash + (symbol != null ? symbol.hashCode() : 0); 369 hash = 17 * hash + (mapImageAngle != null ? mapImageAngle.hashCode() : 0); 370 return hash; 360 return Objects.hash(super.hashCode(), mapImage, mapImageAngle, symbol); 371 361 } 372 362 373 363 @Override 374 364 public boolean equals(Object obj) { 375 if (obj == null || getClass() != obj.getClass()) 376 return false; 377 if (!super.equals(obj)) 378 return false; 379 380 final NodeElement other = (NodeElement) obj; 381 // we should get the same image object due to caching 382 if (!Objects.equals(mapImage, other.mapImage)) 383 return false; 384 if (!Objects.equals(symbol, other.symbol)) 385 return false; 386 if (!Objects.equals(mapImageAngle, other.mapImageAngle)) 387 return false; 388 return true; 365 if (this == obj) return true; 366 if (obj == null || getClass() != obj.getClass()) return false; 367 if (!super.equals(obj)) return false; 368 NodeElement that = (NodeElement) obj; 369 return Objects.equals(mapImage, that.mapImage) && 370 Objects.equals(mapImageAngle, that.mapImageAngle) && 371 Objects.equals(symbol, that.symbol); 389 372 } 390 373 391 374 @Override 375 392 376 public String toString() { 393 377 StringBuilder s = new StringBuilder("NodeElemStyle{"); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/RepeatImageElement.java
r9341 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.mappaint.styleelement; 3 4 import java.util.Objects; 3 5 4 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 66 68 @Override 67 69 public boolean equals(Object obj) { 68 if (obj == null || getClass() != obj.getClass()) 69 return false; 70 if (!super.equals(obj)) 71 return false; 72 final RepeatImageElement other = (RepeatImageElement) obj; 73 if (!this.pattern.equals(other.pattern)) return false; 74 if (this.offset != other.offset) return false; 75 if (this.spacing != other.spacing) return false; 76 if (this.phase != other.phase) return false; 77 if (this.align != other.align) return false; 78 return true; 70 if (this == obj) return true; 71 if (obj == null || getClass() != obj.getClass()) return false; 72 if (!super.equals(obj)) return false; 73 RepeatImageElement that = (RepeatImageElement) obj; 74 return Float.compare(that.offset, offset) == 0 && 75 Float.compare(that.spacing, spacing) == 0 && 76 Float.compare(that.phase, phase) == 0 && 77 Objects.equals(pattern, that.pattern) && 78 align == that.align; 79 79 } 80 80 81 81 @Override 82 82 public int hashCode() { 83 int hash = super.hashCode(); 84 hash = 83 * hash + this.pattern.hashCode(); 85 hash = 83 * hash + Float.floatToIntBits(this.offset); 86 hash = 83 * hash + Float.floatToIntBits(this.spacing); 87 hash = 83 * hash + Float.floatToIntBits(this.phase); 88 hash = 83 * hash + this.align.hashCode(); 89 return hash; 83 return Objects.hash(super.hashCode(), pattern, offset, spacing, phase, align); 90 84 } 91 85 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java
r9341 r9371 5 5 import java.util.HashMap; 6 6 import java.util.Map; 7 import java.util.Objects; 7 8 8 9 import org.openstreetmap.josm.Main; … … 147 148 @Override 148 149 public int hashCode() { 149 final int prime = 31; 150 int result = 1; 151 result = prime * result + ((name == null) ? 0 : name.hashCode()); 152 result = prime * result + size; 153 result = prime * result + style; 154 return result; 150 return Objects.hash(name, style, size); 155 151 } 156 152 157 153 @Override 158 154 public boolean equals(Object obj) { 159 if (this == obj) 160 return true; 161 if (obj == null) 162 return false; 163 if (getClass() != obj.getClass()) 164 return false; 165 FontDescriptor other = (FontDescriptor) obj; 166 if (name == null) { 167 if (other.name != null) 168 return false; 169 } else if (!name.equals(other.name)) 170 return false; 171 if (size != other.size) 172 return false; 173 if (style != other.style) 174 return false; 175 return true; 155 if (this == obj) return true; 156 if (obj == null || getClass() != obj.getClass()) return false; 157 FontDescriptor that = (FontDescriptor) obj; 158 return style == that.style && 159 size == that.size && 160 Objects.equals(name, that.name); 176 161 } 177 162 } … … 214 199 @Override 215 200 public boolean equals(Object o) { 216 if ( !(o instanceof StyleElement))217 218 StyleElement s= (StyleElement) o;219 return isModifier == s.isModifier&&220 majorZIndex == s.majorZIndex&&221 zIndex == s.zIndex&&222 objectZIndex == s.objectZIndex;201 if (this == o) return true; 202 if (o == null || getClass() != o.getClass()) return false; 203 StyleElement that = (StyleElement) o; 204 return Float.compare(that.majorZIndex, majorZIndex) == 0 && 205 Float.compare(that.zIndex, zIndex) == 0 && 206 Float.compare(that.objectZIndex, objectZIndex) == 0 && 207 isModifier == that.isModifier; 223 208 } 224 209 225 210 @Override 226 211 public int hashCode() { 227 int hash = 5; 228 hash = 41 * hash + Float.floatToIntBits(this.majorZIndex); 229 hash = 41 * hash + Float.floatToIntBits(this.zIndex); 230 hash = 41 * hash + Float.floatToIntBits(this.objectZIndex); 231 hash = 41 * hash + (isModifier ? 1 : 0); 232 return hash; 212 return Objects.hash(majorZIndex, zIndex, objectZIndex, isModifier); 233 213 } 234 214 -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java
r9278 r9371 201 201 @Override 202 202 public int hashCode() { 203 int hash = 3; 204 hash = 79 * hash + (labelCompositionStrategy != null ? labelCompositionStrategy.hashCode() : 0); 205 hash = 79 * hash + font.hashCode(); 206 hash = 79 * hash + xOffset; 207 hash = 79 * hash + yOffset; 208 hash = 79 * hash + color.hashCode(); 209 hash = 79 * hash + (haloRadius != null ? Float.floatToIntBits(haloRadius) : 0); 210 hash = 79 * hash + (haloColor != null ? haloColor.hashCode() : 0); 211 return hash; 203 return Objects.hash(labelCompositionStrategy, font, xOffset, yOffset, color, haloRadius, haloColor); 212 204 } 213 205 214 206 @Override 215 207 public boolean equals(Object obj) { 216 if ( obj == null || getClass() != obj.getClass())217 218 final TextLabel other= (TextLabel) obj;219 return Objects.equals(labelCompositionStrategy, other.labelCompositionStrategy)&&220 Objects.equals(font, other.font)&&221 xOffset == other.xOffset&&222 yOffset == other.yOffset&&223 Objects.equals(color, other.color) &&224 Objects.equals(haloRadius, other.haloRadius) &&225 Objects.equals(haloColor, other.haloColor);208 if (this == obj) return true; 209 if (obj == null || getClass() != obj.getClass()) return false; 210 TextLabel textLabel = (TextLabel) obj; 211 return xOffset == textLabel.xOffset && 212 yOffset == textLabel.yOffset && 213 Objects.equals(labelCompositionStrategy, textLabel.labelCompositionStrategy) && 214 Objects.equals(font, textLabel.font) && 215 Objects.equals(color, textLabel.color) && 216 Objects.equals(haloRadius, textLabel.haloRadius) && 217 Objects.equals(haloColor, textLabel.haloColor); 226 218 } 227 219 } -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
r8377 r9371 109 109 @Override 110 110 public boolean equals(Object obj) { 111 if ( obj == null || getClass() != obj.getClass())112 113 final SourceEntry other= (SourceEntry) obj;114 return Objects.equals(other.url, url)&&115 other.isZip == isZip&&116 Objects.equals( other.zipEntryPath, zipEntryPath) &&117 Objects.equals( other.name, name) &&118 Objects.equals( other.title, title) &&119 other.active == active;111 if (this == obj) return true; 112 if (obj == null || getClass() != obj.getClass()) return false; 113 SourceEntry that = (SourceEntry) obj; 114 return isZip == that.isZip && 115 active == that.active && 116 Objects.equals(url, that.url) && 117 Objects.equals(zipEntryPath, that.zipEntryPath) && 118 Objects.equals(name, that.name) && 119 Objects.equals(title, that.title); 120 120 } 121 121 122 122 @Override 123 123 public int hashCode() { 124 int hash = 5; 125 hash = 89 * hash + (this.url != null ? this.url.hashCode() : 0); 126 hash = 89 * hash + (this.isZip ? 1 : 0); 127 hash = 89 * hash + (this.zipEntryPath != null ? this.zipEntryPath.hashCode() : 0); 128 hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0); 129 hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0); 130 hash = 89 * hash + (this.active ? 1 : 0); 131 return hash; 124 return Objects.hash(url, isZip, zipEntryPath, name, title, active); 132 125 } 133 126 -
trunk/src/org/openstreetmap/josm/gui/progress/ProgressTaskId.java
r8846 r9371 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.progress; 3 4 import java.util.Objects; 3 5 4 6 public class ProgressTaskId { … … 16 18 @Override 17 19 public int hashCode() { 18 return id.hashCode();20 return Objects.hash(id); 19 21 } 20 22 21 23 @Override 22 24 public boolean equals(Object obj) { 23 if (this == obj) 24 return true; 25 if (obj == null) 26 return false; 27 if (getClass() != obj.getClass()) 28 return false; 29 ProgressTaskId other = (ProgressTaskId) obj; 30 return other.id.equals(id); 25 if (this == obj) return true; 26 if (obj == null || getClass() != obj.getClass()) return false; 27 ProgressTaskId that = (ProgressTaskId) obj; 28 return Objects.equals(id, that.id); 31 29 } 32 30 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r9266 r9371 84 84 @Override 85 85 public int hashCode() { 86 int hash = 7; 87 hash = 59 * hash + Objects.hashCode(this.key); 88 hash = 59 * hash + Objects.hashCode(this.value); 89 hash = 59 * hash + (this.defaultKey ? 1 : 0); 90 return hash; 86 return Objects.hash(key, value, defaultKey); 91 87 } 92 88
Note:
See TracChangeset
for help on using the changeset viewer.