- Timestamp:
- 2016-08-03T17:54:36+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java
r10680 r10721 24 24 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 25 25 import org.openstreetmap.josm.tools.MultiMap; 26 import org.openstreetmap.josm.tools.Utils;27 26 28 27 /** … … 158 157 159 158 // Step 6 160 d[i][j] = Utils.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);159 d[i][j] = Math.min(Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1), d[i - 1][j - 1] + cost); 161 160 } 162 161 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r10680 r10721 7 7 import java.awt.Stroke; 8 8 import java.util.Objects; 9 import java.util.stream.IntStream; 9 10 10 11 import org.openstreetmap.josm.Main; … … 324 325 } 325 326 326 final int size = Utils.max(selected ? settings.getSelectedNodeSize() : 0, 327 final int size = max( 328 selected ? settings.getSelectedNodeSize() : 0, 327 329 n.isTagged() ? settings.getTaggedNodeSize() : 0, 328 330 isConnection ? settings.getConnectionNodeSize() : 0, … … 350 352 // This is only executed once, so no performance concerns. 351 353 // However, it would be better, if the settings could be changed at runtime. 352 int size = Utils.max(354 int size = max( 353 355 Main.pref.getInteger("mappaint.node.selected-size", 5), 354 356 Main.pref.getInteger("mappaint.node.unselected-size", 3), … … 358 360 return new SimpleBoxProvider(new Rectangle(-size/2, -size/2, size, size)); 359 361 } 362 } 363 364 private static int max(int... elements) { 365 return IntStream.of(elements).max().orElseThrow(IllegalStateException::new); 360 366 } 361 367 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r10718 r10721 223 223 224 224 /** 225 * Returns the minimum of three values.226 * @param a an argument.227 * @param b another argument.228 * @param c another argument.229 * @return the smaller of {@code a}, {@code b} and {@code c}.230 */231 public static int min(int a, int b, int c) {232 if (b < c) {233 if (a < b)234 return a;235 return b;236 } else {237 if (a < c)238 return a;239 return c;240 }241 }242 243 /**244 * Returns the greater of four {@code int} values. That is, the245 * result is the argument closer to the value of246 * {@link Integer#MAX_VALUE}. If the arguments have the same value,247 * the result is that same value.248 *249 * @param a an argument.250 * @param b another argument.251 * @param c another argument.252 * @param d another argument.253 * @return the larger of {@code a}, {@code b}, {@code c} and {@code d}.254 */255 public static int max(int a, int b, int c, int d) {256 return Math.max(Math.max(a, b), Math.max(c, d));257 }258 259 /**260 225 * Ensures a logical condition is met. Otherwise throws an assertion error. 261 226 * @param condition the condition to be met … … 565 530 */ 566 531 public static void close(ZipFile zip) { 567 if (zip == null) return; 568 try { 569 zip.close(); 570 } catch (IOException e) { 571 Main.warn(e); 572 } 532 close((Closeable) zip); 573 533 } 574 534
Note:
See TracChangeset
for help on using the changeset viewer.