Changeset 11893 in josm
- Timestamp:
- 2017-04-13T01:08:58+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r11713 r11893 866 866 boolean prevSegmentParallel = Geometry.segmentsParallel(n1en, prevNode.getEastNorth(), n1en, n2en); 867 867 boolean nextSegmentParallel = Geometry.segmentsParallel(n2en, nextNode.getEastNorth(), n1en, n2en); 868 if (prevSegmentParallel || nextSegmentParallel) { 869 return false; 870 } 871 872 return true; 868 return !prevSegmentParallel && !nextSegmentParallel; 873 869 } 874 870 -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r11535 r11893 424 424 */ 425 425 protected boolean isResponseLoadable(Map<String, List<String>> headerFields, int responseCode, byte[] raw) { 426 if (raw == null || raw.length == 0 || responseCode >= 400) { 427 return false; 428 } 429 return true; 426 return raw != null && raw.length != 0 && responseCode < 400; 430 427 } 431 428 -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r10906 r11893 26 26 public int dir; 27 27 28 /** 29 * Constructs a new {@code WayPoint} from an existing one. 30 * @param p existing waypoint 31 */ 28 32 public WayPoint(WayPoint p) { 29 33 attr.putAll(p.attr); … … 38 42 } 39 43 44 /** 45 * Constructs a new {@code WayPoint} from lat/lon coordinates. 46 * @param ll lat/lon coordinates 47 */ 40 48 public WayPoint(LatLon ll) { 41 49 lat = ll.lat(); … … 64 72 } 65 73 74 /** 75 * Returns the waypoint coordinates. 76 * @return the waypoint coordinates 77 */ 66 78 public final LatLon getCoor() { 67 79 return new LatLon(lat, lon); … … 138 150 } 139 151 152 /** 153 * Returns the waypoint time. 154 * @return the waypoint time 155 */ 140 156 public Date getTime() { 141 157 return new Date((long) (time * 1000)); … … 177 193 if (this == obj) 178 194 return true; 179 if (!super.equals(obj)) 180 return false; 181 if (getClass() != obj.getClass()) 195 if (obj == null || !super.equals(obj) || getClass() != obj.getClass()) 182 196 return false; 183 197 WayPoint other = (WayPoint) obj; 184 if (Double.doubleToLongBits(lat) != Double.doubleToLongBits(other.lat)) 185 return false; 186 if (Double.doubleToLongBits(lon) != Double.doubleToLongBits(other.lon)) 187 return false; 188 if (Double.doubleToLongBits(time) != Double.doubleToLongBits(other.time)) 189 return false; 190 return true; 198 return Double.doubleToLongBits(lat) == Double.doubleToLongBits(other.lat) 199 && Double.doubleToLongBits(lon) == Double.doubleToLongBits(other.lon) 200 && Double.doubleToLongBits(time) == Double.doubleToLongBits(other.time); 191 201 } 192 202 } -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r11878 r11893 380 380 } else if (!user.equals(other.user)) 381 381 return false; 382 if (commentsCount != other.commentsCount) { 383 return false; 384 } 385 return true; 382 return commentsCount == other.commentsCount; 386 383 } 387 384 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r11608 r11893 1152 1152 if (!isNew() && id != other.id) 1153 1153 return false; 1154 if (isIncomplete() ^ other.isIncomplete()) // exclusive or operator for performance (see #7159) 1155 return false; 1156 return true; 1154 return !(isIncomplete() ^ other.isIncomplete()); // exclusive or operator for performance (see #7159) 1157 1155 } 1158 1156 -
trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java
r11397 r11893 121 121 */ 122 122 public boolean isSimilar(WaySegment s2) { 123 if (getFirstNode().equals(s2.getFirstNode()) && getSecondNode().equals(s2.getSecondNode())) 124 return true; 125 if (getFirstNode().equals(s2.getSecondNode()) && getSecondNode().equals(s2.getFirstNode())) 126 return true; 127 return false; 123 return (getFirstNode().equals(s2.getFirstNode()) && getSecondNode().equals(s2.getSecondNode())) 124 || (getFirstNode().equals(s2.getSecondNode()) && getSecondNode().equals(s2.getFirstNode())); 128 125 } 129 126 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r11870 r11893 1454 1454 if (bounds.isEmpty()) return false; 1455 1455 MapViewPoint p = mapState.getPointFor(new EastNorth(bounds.getX(), bounds.getY())); 1456 if (p.getInViewX() > mapState.getViewWidth()) return false; 1457 if (p.getInViewY() < 0) return false; 1456 if (p.getInViewY() < 0 || p.getInViewX() > mapState.getViewWidth()) return false; 1458 1457 p = mapState.getPointFor(new EastNorth(bounds.getX() + bounds.getWidth(), bounds.getY() + bounds.getHeight())); 1459 if (p.getInViewX() < 0) return false; 1460 if (p.getInViewY() > mapState.getViewHeight()) return false; 1461 return true; 1462 } 1463 1458 return p.getInViewX() >= 0 && p.getInViewY() <= mapState.getViewHeight(); 1459 } 1460 1461 /** 1462 * Determines if the paint visitor shall render OSM objects such that they look inactive. 1463 * @return {@code true} if the paint visitor shall render OSM objects such that they look inactive 1464 */ 1464 1465 public boolean isInactiveMode() { 1465 1466 return isInactiveMode; -
trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java
r10378 r11893 225 225 /** 226 226 * Checks if the given segment is in the visible area. 227 * NOTE: This will return true for a small number of non-visible 228 * segments. 227 * NOTE: This will return true for a small number of non-visible segments. 229 228 * @param n1 The first point of the segment to check 230 229 * @param n2 The second point of the segment to check … … 234 233 Point p1 = mv.getPoint(n1); 235 234 Point p2 = mv.getPoint(n2); 236 if ((p1.x < 0) && (p2.x < 0)) 237 return false; 238 if ((p1.y < 0) && (p2.y < 0)) 239 return false; 240 if ((p1.x > mv.getWidth()) && (p2.x > mv.getWidth())) 241 return false; 242 if ((p1.y > mv.getHeight()) && (p2.y > mv.getHeight())) 243 return false; 244 return true; 235 return (p1.x >= 0 || p2.x >= 0) 236 && (p1.y >= 0 || p2.y >= 0) 237 && (p1.x <= mv.getWidth() || p2.x <= mv.getWidth()) 238 && (p1.y <= mv.getHeight() || p2.y <= mv.getHeight()); 245 239 } 246 240 -
trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java
r10338 r11893 191 191 validOctets++; 192 192 } 193 if (validOctets < IPV6_MAX_HEX_GROUPS && !containsCompressedZeroes) { 194 return false; 195 } 196 return true; 193 return validOctets >= IPV6_MAX_HEX_GROUPS || containsCompressedZeroes; 197 194 } 198 195 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r11889 r11893 373 373 } 374 374 375 if (isOff(ALLOW_ALL_SCHEMES) && !allowedSchemes.contains(scheme.toLowerCase(Locale.ENGLISH))) { 376 return false; 377 } 378 379 return true; 375 return isOn(ALLOW_ALL_SCHEMES) || allowedSchemes.contains(scheme.toLowerCase(Locale.ENGLISH)); 380 376 } 381 377 … … 458 454 } 459 455 460 int slash2Count = countToken("//", path); 461 if (slash2Count > 0 && isOff(ALLOW_2_SLASHES)) { 462 return false; 463 } 464 465 return true; 456 return isOn(ALLOW_2_SLASHES) || countToken("//", path) <= 0; 466 457 } 467 458 -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r11852 r11893 84 84 return true; 85 85 } 86 if (isProposedOrAbandoned(w2)) { 87 return true; 88 } 89 return false; 86 return isProposedOrAbandoned(w2); 90 87 } 91 88 … … 160 157 @Override 161 158 boolean ignoreWaySegmentCombination(Way w1, Way w2) { 162 if (!Objects.equals(getLayer(w1), getLayer(w2))) { 163 return true; 164 } 165 return false; 159 return !Objects.equals(getLayer(w1), getLayer(w2)); 166 160 } 167 161 -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r11627 r11893 343 343 // cannot merge nodes outside download area 344 344 final Iterator<? extends OsmPrimitive> it = testError.getPrimitives().iterator(); 345 if (!it.hasNext()||it.next().isOutsideDownloadArea()) return false;345 return it.hasNext() && !it.next().isOutsideDownloadArea(); 346 346 // everything else is ok to merge 347 return true;348 347 } 349 348 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r11839 r11893 768 768 @Override 769 769 public boolean isFixable(TestError testError) { 770 if (testError.getCode() == REPEATED_MEMBER_SAME_ROLE) 771 return true; 772 return false; 770 return testError.getCode() == REPEATED_MEMBER_SAME_ROLE; 773 771 } 774 772 -
trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
r10763 r11893 606 606 return false; 607 607 } 608 if (tileIndex < 0 || tileIndex >= Math.pow(2, zoomLevel)) return false; 609 610 return true; 608 return tileIndex >= 0 && tileIndex < Math.pow(2, zoomLevel); 611 609 } 612 610 -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java
r11848 r11893 276 276 } 277 277 278 /** 279 * Determines if a cell is enabled. 280 * @param row row index 281 * @param column column index 282 * @return {@code true} if the cell at (row, column) is enabled 283 */ 278 284 public boolean isCellEnabled(int row, int column) { 279 if (!filters.get(row).enable && column != 0) 280 return false; 281 return true; 285 return filters.get(row).enable || column == 0; 282 286 } 283 287 284 288 @Override 285 289 public boolean isCellEditable(int row, int column) { 286 if (!filters.get(row).enable && column != 0) 287 return false; 288 if (column < 4) 289 return true; 290 return false; 290 return column < 4 && isCellEnabled(row, column); 291 291 } 292 292 -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r11885 r11893 985 985 @Override 986 986 public boolean isCellEditable(int row, int col) { 987 if (col == 0 && getActiveLayer() == getLayers().get(row)) 988 return false; 989 return true; 987 return col != 0 || getActiveLayer() != getLayers().get(row); 990 988 } 991 989 -
trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerListTransferHandler.java
r11881 r11893 74 74 } 75 75 76 if (support.getDropAction() == LINK) { 77 // cannot link yet. 78 return false; 79 } 80 81 return true; 76 // cannot link yet. 77 return support.getDropAction() != LINK; 82 78 } 83 79 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r11747 r11893 334 334 335 335 public boolean canRemove(int... rows) { 336 if (rows == null || rows.length == 0) 337 return false; 338 return true; 336 return rows != null && rows.length != 0; 339 337 } 340 338 -
trunk/src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java
r10873 r11893 124 124 125 125 private static boolean canWrite(File f) { 126 if (f == null) return false; 127 if (f.isDirectory()) return false; 126 if (f == null || f.isDirectory()) return false; 128 127 if (f.exists() && f.canWrite()) return true; 129 if (!f.exists() && f.getParentFile() != null && f.getParentFile().canWrite()) 130 return true; 131 return false; 128 return !f.exists() && f.getParentFile() != null && f.getParentFile().canWrite(); 132 129 } 133 130 -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r11891 r11893 1071 1071 return false; 1072 1072 int status = Toolkit.getDefaultToolkit().checkImage(i, -1, -1, this); 1073 if ((status & ALLBITS) != 0) 1074 return true; 1075 return false; 1073 return (status & ALLBITS) != 0; 1076 1074 } 1077 1075 -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r11747 r11893 1026 1026 1027 1027 ConflictCollection conflictsCol = getConflicts(); 1028 if (conflictsCol!= null&& !conflictsCol.isEmpty()&& 1 != GuiHelper.runInEDTAndWaitAndReturn(() -> {1028 return conflictsCol == null || conflictsCol.isEmpty() || 1 == GuiHelper.runInEDTAndWaitAndReturn(() -> { 1029 1029 ExtendedDialog dialog = new ExtendedDialog( 1030 1030 Main.parent, … … 1037 1037 dialog.setButtonIcons(new String[] {"save", "cancel"}); 1038 1038 return dialog.showDialog().getValue(); 1039 })) { 1040 return false; 1041 } 1042 return true; 1039 }); 1043 1040 } 1044 1041 -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/ReprojectionTile.java
r11883 r11893 53 53 if (Utils.equalsEpsilon(nativeScale, currentScale)) 54 54 return false; 55 if (maxZoomReached && currentScale < nativeScale) 56 // zoomed in even more - max zoom already reached, so no update 57 return false; 58 return true; 55 // zoomed in even more - max zoom already reached, so no update 56 return !maxZoomReached || currentScale >= nativeScale; 59 57 } 60 58 -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileSourceDisplaySettings.java
r11746 r11893 295 295 if (this == obj) 296 296 return true; 297 if (obj == null) 298 return false; 299 if (getClass() != obj.getClass()) 297 if (obj == null || getClass() != obj.getClass()) 300 298 return false; 301 299 TileSourceDisplaySettings other = (TileSourceDisplaySettings) obj; 302 if (autoLoad != other.autoLoad) 303 return false; 304 if (autoZoom != other.autoZoom) 305 return false; 306 if (showErrors != other.showErrors) 307 return false; 308 return true; 300 return autoLoad == other.autoLoad 301 && autoZoom == other.autoZoom 302 && showErrors == other.showErrors; 309 303 } 310 304 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java
r11779 r11893 625 625 if (e.osm instanceof Way && ((Way) e.osm).isClosed()) 626 626 return true; 627 if (e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon()) 628 return true; 629 return false; 627 return e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon(); 630 628 } 631 629 -
trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java
r11731 r11893 57 57 return true; 58 58 } 59 if (obj == null) { 60 return false; 61 } 62 if (getClass() != obj.getClass()) { 63 return false; 64 } 65 return true; 59 return obj != null && getClass() == obj.getClass(); 66 60 } 67 68 61 } 69 62 … … 92 85 final int prime = 31; 93 86 int result = 1; 94 long temp; 95 temp = Double.doubleToLongBits(angle); 87 long temp = Double.doubleToLongBits(angle); 96 88 result = prime * result + (int) (temp ^ (temp >>> 32)); 97 89 return result; … … 103 95 return true; 104 96 } 105 if (obj == null) { 106 return false; 107 } 108 if (getClass() != obj.getClass()) { 97 if (obj == null || getClass() != obj.getClass()) { 109 98 return false; 110 99 } 111 100 StaticRotationAngle other = (StaticRotationAngle) obj; 112 if (Double.doubleToLongBits(angle) != Double.doubleToLongBits(other.angle)) { 113 return false; 114 } 115 return true; 101 return Double.doubleToLongBits(angle) == Double.doubleToLongBits(other.angle); 116 102 } 117 103 } -
trunk/src/org/openstreetmap/josm/gui/widgets/BoundingBoxSelectionPanel.java
r9059 r11893 152 152 @Override 153 153 public boolean isValid() { 154 double value = 0; 155 try { 156 value = Double.parseDouble(getComponent().getText()); 154 try { 155 return LatLon.isValidLat(Double.parseDouble(getComponent().getText())); 157 156 } catch (NumberFormatException ex) { 158 157 return false; 159 158 } 160 if (!LatLon.isValidLat(value))161 return false;162 return true;163 159 } 164 160 } … … 192 188 @Override 193 189 public boolean isValid() { 194 double value = 0; 195 try { 196 value = Double.parseDouble(getComponent().getText()); 190 try { 191 return LatLon.isValidLon(Double.parseDouble(getComponent().getText())); 197 192 } catch (NumberFormatException ex) { 198 193 return false; 199 194 } 200 if (!LatLon.isValidLon(value))201 return false;202 return true;203 195 } 204 196 } -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r11848 r11893 430 430 if (this.version == null && referenceVersion != null) 431 431 return true; 432 if (this.version != null && !this.version.equals(referenceVersion)) 433 return true; 434 return false; 432 return this.version != null && !this.version.equals(referenceVersion); 435 433 } 436 434 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r11879 r11893 1192 1192 */ 1193 1193 public static boolean isLocalUrl(String url) { 1194 if (url == null || url.startsWith("http://") || url.startsWith("https://") || url.startsWith("resource://")) 1195 return false; 1196 return true; 1194 return url != null && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("resource://"); 1197 1195 } 1198 1196 -
trunk/tools/checkstyle/josm_checks.xml
r11747 r11893 15 15 <module name="TreeWalker"> 16 16 <module name="BooleanExpressionComplexity"> 17 <property name="max" value=" 6"/>17 <property name="max" value="7"/> 18 18 </module> 19 19 <module name="CatchParameterName">
Note:
See TracChangeset
for help on using the changeset viewer.