- Timestamp:
- 2015-10-22T14:35:57+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/Plugin.java
r8840 r8928 92 92 * Called in the preferences dialog to create a preferences page for the plugin, 93 93 * if any available. 94 * @return the preferences dialog, or {@code null} 94 95 */ 95 96 public PreferenceSetting getPreferenceSetting() { … … 141 142 * 142 143 * (Note the missing leading "/".) 144 * @return a class loader for loading resources from the plugin jar 143 145 */ 144 146 public ClassLoader getPluginResourceClassLoader() { -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r8882 r8928 953 953 * @param monitor the progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null. 954 954 * @param displayErrMsg if {@code true}, a blocking error message is displayed in case of I/O exception. 955 * @return the list of plugins to load 955 956 * @throws IllegalArgumentException if plugins is null 956 957 */ -
trunk/src/org/openstreetmap/josm/tools/AlphanumComparator.java
r8870 r8928 61 61 62 62 /** 63 * Length of string is passed in for improved efficiency (only need to 64 * calculate it once) * 63 * Returns an alphanum chunk. 64 * Length of string is passed in for improved efficiency (only need to calculate it once). 65 * @param s string 66 * @param slength string length 67 * @param marker position 68 * @return alphanum chunk found at given position 65 69 */ 66 70 private static String getChunk(String s, int slength, int marker) { -
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r8855 r8928 123 123 */ 124 124 public static void play(URL url) throws Exception { 125 AudioPlayer.get().command.play(url, 0.0, 1.0); 125 AudioPlayer.getInstance().command.play(url, 0.0, 1.0); 126 126 } 127 127 … … 133 133 */ 134 134 public static void play(URL url, double seconds) throws Exception { 135 AudioPlayer.get().command.play(url, seconds, 1.0); 135 AudioPlayer.getInstance().command.play(url, seconds, 1.0); 136 136 } 137 137 … … 144 144 */ 145 145 public static void play(URL url, double seconds, double speed) throws Exception { 146 AudioPlayer.get().command.play(url, seconds, speed); 146 AudioPlayer.getInstance().command.play(url, seconds, speed); 147 147 } 148 148 … … 152 152 */ 153 153 public static void pause() throws Exception { 154 AudioPlayer.get().command.pause(); 154 AudioPlayer.getInstance().command.pause(); 155 155 } 156 156 … … 160 160 */ 161 161 public static URL url() { 162 return AudioPlayer.get().playingUrl; 162 return AudioPlayer.getInstance().playingUrl; 163 163 } 164 164 … … 168 168 */ 169 169 public static boolean paused() { 170 return AudioPlayer.get().state == State.PAUSED; 170 return AudioPlayer.getInstance().state == State.PAUSED; 171 171 } 172 172 … … 176 176 */ 177 177 public static boolean playing() { 178 return AudioPlayer.get().state == State.PLAYING; 178 return AudioPlayer.getInstance().state == State.PLAYING; 179 179 } 180 180 … … 184 184 */ 185 185 public static double position() { 186 return AudioPlayer.get().position; 186 return AudioPlayer.getInstance().position; 187 187 } 188 188 … … 192 192 */ 193 193 public static double speed() { 194 return AudioPlayer.get().speed; 195 } 196 197 /** 198 * gets the singleton object, and if this is the first time, creates it along with 199 * the thread to support audio 200 */ 201 private static AudioPlayer get() { 194 return AudioPlayer.getInstance().speed; 195 } 196 197 /** 198 * Returns the singleton object, and if this is the first time, creates it along with 199 * the thread to support audio 200 * @return the unique instance 201 */ 202 private static AudioPlayer getInstance() { 202 203 if (audioPlayer != null) 203 204 return audioPlayer; … … 206 207 return audioPlayer; 207 208 } catch (Exception ex) { 209 Main.error(ex); 208 210 return null; 209 211 } -
trunk/src/org/openstreetmap/josm/tools/Diff.java
r8926 r8928 128 128 private static final int SNAKE_LIMIT = 20; 129 129 130 /** Find the midpoint of the shortest edit script for a specified 131 portion of the two files. 132 133 We scan from the beginnings of the files, and simultaneously from the ends, 134 doing a breadth-first search through the space of edit-sequence. 135 When the two searches meet, we have found the midpoint of the shortest 136 edit sequence. 137 138 The value returned is the number of the diagonal on which the midpoint lies. 139 The diagonal number equals the number of inserted lines minus the number 140 of deleted lines (counting only lines before the midpoint). 141 The edit cost is stored into COST; this is the total number of 142 lines inserted or deleted (counting only lines before the midpoint). 143 144 This function assumes that the first lines of the specified portions 145 of the two files do not match, and likewise that the last lines do not 146 match. The caller must trim matching lines from the beginning and end 147 of the portions it is going to specify. 148 149 Note that if we return the "wrong" diagonal value, or if 150 the value of bdiag at that diagonal is "wrong", 151 the worst this can do is cause suboptimal diff output. 152 It cannot cause incorrect diff output. */ 153 130 /** 131 * Find the midpoint of the shortest edit script for a specified 132 * portion of the two files. 133 * 134 * We scan from the beginnings of the files, and simultaneously from the ends, 135 * doing a breadth-first search through the space of edit-sequence. 136 * When the two searches meet, we have found the midpoint of the shortest 137 * edit sequence. 138 * 139 * The value returned is the number of the diagonal on which the midpoint lies. 140 * The diagonal number equals the number of inserted lines minus the number 141 * of deleted lines (counting only lines before the midpoint). 142 * The edit cost is stored into COST; this is the total number of 143 * lines inserted or deleted (counting only lines before the midpoint). 144 * 145 * This function assumes that the first lines of the specified portions 146 * of the two files do not match, and likewise that the last lines do not 147 * match. The caller must trim matching lines from the beginning and end 148 * of the portions it is going to specify. 149 * 150 * Note that if we return the "wrong" diagonal value, or if 151 * the value of bdiag at that diagonal is "wrong", 152 * the worst this can do is cause suboptimal diff output. 153 * It cannot cause incorrect diff output. 154 */ 154 155 private int diag(int xoff, int xlim, int yoff, int ylim) { 155 156 final int[] fd = fdiag; // Give the compiler a chance. … … 476 477 reverseScript = new ReverseScript(); 477 478 478 /** Report the differences of two files. DEPTH is the current directory 479 depth. */ 479 /** Report the differences of two files. DEPTH is the current directory depth. */ 480 480 public final Change diff_2(final boolean reverse) { 481 481 return diff(reverse ? reverseScript : forwardScript); -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r8855 r8928 876 876 * Tests if the {@code node} is inside the multipolygon {@code multiPolygon}. The nullable argument 877 877 * {@code isOuterWayAMatch} allows to decide if the immediate {@code outer} way of the multipolygon is a match. 878 * @param node node 879 * @param multiPolygon multipolygon 880 * @param isOuterWayAMatch allows to decide if the immediate {@code outer} way of the multipolygon is a match 881 * @return {@code true} if the node is inside the multipolygon 878 882 */ 879 883 public static boolean isNodeInsideMultiPolygon(Node node, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) { … … 886 890 * <p> 887 891 * If {@code nodes} contains exactly one element, then it is checked whether that one node is inside the multipolygon. 892 * @param nodes nodes forming the polygon 893 * @param multiPolygon multipolygon 894 * @param isOuterWayAMatch allows to decide if the immediate {@code outer} way of the multipolygon is a match 895 * @return {@code true} if the polygon formed by nodes is inside the multipolygon 888 896 */ 889 897 public static boolean isPolygonInsideMultiPolygon(List<Node> nodes, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) { -
trunk/src/org/openstreetmap/josm/tools/Predicates.java
r8378 r8928 18 18 /** 19 19 * Returns the negation of {@code predicate}. 20 * @param predicate the predicate to negate 21 * @return the negation of {@code predicate} 20 22 */ 21 23 public static <T> Predicate<T> not(final Predicate<T> predicate) { … … 30 32 /** 31 33 * Returns a {@link Predicate} executing {@link Objects#equals}. 34 * @param ref the reference object 35 * @return a {@link Predicate} executing {@link Objects#equals} 32 36 */ 33 37 public static <T> Predicate<T> equalTo(final T ref) { … … 42 46 /** 43 47 * Returns a {@link Predicate} executing {@link Pattern#matcher(CharSequence)} and {@link java.util.regex.Matcher#matches}. 48 * @param pattern the pattern 49 * @return a {@link Predicate} executing {@link Pattern#matcher(CharSequence)} and {@link java.util.regex.Matcher#matches} 44 50 */ 45 51 public static Predicate<String> stringMatchesPattern(final Pattern pattern) { … … 54 60 /** 55 61 * Returns a {@link Predicate} executing {@link Pattern#matcher(CharSequence)} and {@link java.util.regex.Matcher#find}. 62 * @param pattern the pattern 63 * @return a {@link Predicate} executing {@link Pattern#matcher(CharSequence)} and {@link java.util.regex.Matcher#find} 56 64 */ 57 65 public static Predicate<String> stringContainsPattern(final Pattern pattern) { … … 66 74 /** 67 75 * Returns a {@link Predicate} executing {@link String#contains(CharSequence)}. 76 * @param pattern the pattern 77 * @return a {@link Predicate} executing {@link String#contains(CharSequence)} 68 78 */ 69 79 public static Predicate<String> stringContains(final String pattern) { … … 78 88 /** 79 89 * Returns a {@link Predicate} executing {@link OsmPrimitive#hasTag(String, String...)}. 90 * @param key the key forming the tag 91 * @param values one or many values forming the tag 92 * @return a {@link Predicate} executing {@link OsmPrimitive#hasTag(String, String...)} 80 93 */ 81 94 public static Predicate<OsmPrimitive> hasTag(final String key, final String... values) { … … 90 103 /** 91 104 * Returns a {@link Predicate} executing {@link OsmPrimitive#hasKey(String)}. 105 * @param key the key 106 * @return a {@link Predicate} executing {@link OsmPrimitive#hasKey(String)} 92 107 */ 93 108 public static Predicate<OsmPrimitive> hasKey(final String key) { … … 102 117 /** 103 118 * Returns a {@link Predicate} executing {@link Collection#contains(Object)}. 119 * @param target collection 120 * @return a {@link Predicate} executing {@link Collection#contains(Object)} 104 121 */ 105 122 public static <T> Predicate<T> inCollection(final Collection<? extends T> target) { … … 114 131 /** 115 132 * Returns a {@link Predicate} testing whether objects are {@code null}. 133 * @return a {@link Predicate} testing whether objects are {@code null} 116 134 */ 117 135 public static <T> Predicate<T> isNull() { -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r8846 r8928 152 152 /** 153 153 * Use this to register the shortcut with Swing 154 * @return the key stroke 154 155 */ 155 156 public KeyStroke getKeyStroke() { … … 233 234 234 235 /** 235 * use this to get a human readable text for your shortcut 236 * Returns a human readable text for the shortcut. 237 * @return a human readable text for the shortcut 236 238 */ 237 239 public String getKeyText() { … … 270 272 271 273 /** 272 * FOR PREF PANE ONLY 274 * Returns a list of all shortcuts. 275 * @return a list of all shortcuts 273 276 */ 274 277 public static List<Shortcut> listAll() { … … 384 387 385 388 /** 386 * FOR PLATFORMHOOK USE ONLY 387 * 389 * FOR PLATFORMHOOK USE ONLY. 390 * <p> 388 391 * This registers a system shortcut. See PlatformHook for details. 392 * @param shortText an ID. re-use a {@code "system:*"} ID if possible, else use something unique. 393 * @param longText this will be displayed in the shortcut preferences dialog. Better 394 * use something the user will recognize... 395 * @param key the key. Use a {@link KeyEvent KeyEvent.VK_*} constant here. 396 * @param modifier the modifier. Use a {@link KeyEvent KeyEvent.*_MASK} constant here. 397 * @return the system shortcut 389 398 */ 390 399 public static Shortcut registerSystemShortcut(String shortText, String longText, int key, int modifier) { … … 416 425 * @param requestedGroup the group this shortcut fits best. This will determine the 417 426 * modifiers your shortcut will get assigned. Use the constants defined above. 427 * @return the shortcut 418 428 */ 419 429 public static Shortcut registerShortcut(String shortText, String longText, int requestedKey, int requestedGroup) { -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r8846 r8928 55 55 /** 56 56 * Read tags from "Free format" 57 * @return map of tags 57 58 */ 58 Map<String, String> 59 private Map<String, String> getFreeParsedTags() { 59 60 String k, v; 60 61 Map<String, String> tags = new HashMap<>(); … … 168 169 * @param tagRegex - each part is matched against this regex 169 170 * @param unescapeTextInQuotes - if true, matched tag and value will be analyzed more thoroughly 171 * @return map of tags 170 172 */ 171 173 public static Map<String, String> readTagsByRegexp(String text, String splitRegex, String tagRegex, boolean unescapeTextInQuotes) { -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r8926 r8928 88 88 89 89 /** 90 * Tests whether {@code predicate} applies to at least one elements from {@code collection}. 90 * Tests whether {@code predicate} applies to at least one element from {@code collection}. 91 * @param collection the collection 92 * @param predicate the predicate 93 * @return {@code true} if {@code predicate} applies to at least one element from {@code collection} 91 94 */ 92 95 public static <T> boolean exists(Iterable<? extends T> collection, Predicate<? super T> predicate) { … … 100 103 /** 101 104 * Tests whether {@code predicate} applies to all elements from {@code collection}. 105 * @param collection the collection 106 * @param predicate the predicate 107 * @return {@code true} if {@code predicate} applies to all elements from {@code collection} 102 108 */ 103 109 public static <T> boolean forAll(Iterable<? extends T> collection, Predicate<? super T> predicate) { … … 152 158 * Filter a collection by (sub)class. 153 159 * This is an efficient read-only implementation. 160 * @param collection the collection 161 * @param klass the (sub)class 162 * @return a read-only filtered collection 154 163 */ 155 164 public static <S, T extends S> SubclassFilteredCollection<S, T> filteredCollection(Collection<S> collection, final Class<T> klass) { … … 281 290 * convert Color to String 282 291 * (Color.toString() omits alpha value) 292 * @param c the color 293 * @return the String representation, including alpha 283 294 */ 284 295 public static String toString(Color c) { … … 308 319 * convert integer range 0..255 to float range 0 <= x <= 1 309 320 * when dealing with colors and color alpha value 321 * @param val integer value 322 * @return corresponding float value in range 0 <= x <= 1 310 323 */ 311 324 public static Float color_int2float(Integer val) {
Note:
See TracChangeset
for help on using the changeset viewer.