Changeset 18801 in josm for trunk/src/org/openstreetmap/josm/tools/Utils.java
- Timestamp:
- 2023-08-09T15:30:01+02:00 (3 years ago)
- File:
-
- 1 edited
-
trunk/src/org/openstreetmap/josm/tools/Utils.java (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r18580 r18801 174 174 175 175 /** 176 * Return the modulus in the range [0, n) 177 * @param a dividend 178 * @param n divisor 179 * @return modulo (remainder of the Euclidian division of a by n) 176 * Returns the modulo in the range [0, n) for the given dividend and divisor. 177 * @param a the dividend 178 * @param n the divisor 179 * @return the modulo, which is the remainder of the Euclidean division of a by n, in the range [0, n) 180 * @throws IllegalArgumentException if n is less than or equal to 0 180 181 */ 181 182 public static int mod(int a, int n) { 182 183 if (n <= 0) 183 throw new IllegalArgumentException("n must be <= 0 but is " +n);184 throw new IllegalArgumentException("n must be <= 0 but is " + n); 184 185 int res = a % n; 185 186 if (res < 0) { … … 290 291 * @param in The source directory 291 292 * @param out The destination directory 292 * @throws IOException if any I/O error o occurs293 * @throws IOException if any I/O error occurs 293 294 * @throws IllegalArgumentException if {@code in} or {@code out} is {@code null} 294 295 * @since 7835 … … 1005 1006 1006 1007 /** 1007 * Cast an object sa vely.1008 * Cast an object safely. 1008 1009 * @param <T> the target type 1009 1010 * @param o the object to cast … … 1088 1089 * @param <T> type of elements 1089 1090 * @param elements collection to shorten 1090 * @param maxElements maximum number of elements to keep (including includingthe {@code overflowIndicator})1091 * @param maxElements maximum number of elements to keep (including the {@code overflowIndicator}) 1091 1092 * @param overflowIndicator the element used to indicate that the collection has been shortened 1092 1093 * @return the shortened collection … … 1762 1763 int pPos = version.indexOf('+'); 1763 1764 try { 1764 return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1 , version.length()));1765 return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1)); 1765 1766 } catch (NumberFormatException e) { 1766 1767 Logging.trace(e); … … 1828 1829 /** 1829 1830 * Determines if a class can be found for the given name. 1830 * @param className class n mae to find1831 * @param className class name to find 1831 1832 * @return {@code true} if the class can be found, {@code false} otherwise 1832 1833 * @since 17692 … … 1921 1922 1922 1923 /** 1923 * Convenient method to open an URL stream, using JOSM HTTP client if nee eded.1924 * Convenient method to open an URL stream, using JOSM HTTP client if needed. 1924 1925 * @param url URL for reading from 1925 1926 * @return an input stream for reading from the URL
Note:
See TracChangeset
for help on using the changeset viewer.
