Changeset 8928 in josm for trunk


Ignore:
Timestamp:
2015-10-22T14:35:57+02:00 (8 years ago)
Author:
Don-vip
Message:

javadoc fixes

Location:
trunk/src/org/openstreetmap/josm
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/Plugin.java

    r8840 r8928  
    9292     * Called in the preferences dialog to create a preferences page for the plugin,
    9393     * if any available.
     94     * @return the preferences dialog, or {@code null}
    9495     */
    9596    public PreferenceSetting getPreferenceSetting() {
     
    141142     *
    142143     * (Note the missing leading "/".)
     144     * @return a class loader for loading resources from the plugin jar
    143145     */
    144146    public ClassLoader getPluginResourceClassLoader() {
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r8882 r8928  
    953953     * @param monitor the progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null.
    954954     * @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
    955956     * @throws IllegalArgumentException if plugins is null
    956957     */
  • trunk/src/org/openstreetmap/josm/tools/AlphanumComparator.java

    r8870 r8928  
    6161
    6262    /**
    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
    6569     */
    6670    private static String getChunk(String s, int slength, int marker) {
  • trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java

    r8855 r8928  
    123123     */
    124124    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);
    126126    }
    127127
     
    133133     */
    134134    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);
    136136    }
    137137
     
    144144     */
    145145    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);
    147147    }
    148148
     
    152152     */
    153153    public static void pause() throws Exception {
    154         AudioPlayer.get().command.pause();
     154        AudioPlayer.getInstance().command.pause();
    155155    }
    156156
     
    160160     */
    161161    public static URL url() {
    162         return AudioPlayer.get().playingUrl;
     162        return AudioPlayer.getInstance().playingUrl;
    163163    }
    164164
     
    168168     */
    169169    public static boolean paused() {
    170         return AudioPlayer.get().state == State.PAUSED;
     170        return AudioPlayer.getInstance().state == State.PAUSED;
    171171    }
    172172
     
    176176     */
    177177    public static boolean playing() {
    178         return AudioPlayer.get().state == State.PLAYING;
     178        return AudioPlayer.getInstance().state == State.PLAYING;
    179179    }
    180180
     
    184184     */
    185185    public static double position() {
    186         return AudioPlayer.get().position;
     186        return AudioPlayer.getInstance().position;
    187187    }
    188188
     
    192192     */
    193193    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() {
    202203        if (audioPlayer != null)
    203204            return audioPlayer;
     
    206207            return audioPlayer;
    207208        } catch (Exception ex) {
     209            Main.error(ex);
    208210            return null;
    209211        }
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r8926 r8928  
    128128    private static final int SNAKE_LIMIT = 20;
    129129
    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     */
    154155    private int diag(int xoff, int xlim, int yoff, int ylim) {
    155156        final int[] fd = fdiag; // Give the compiler a chance.
     
    476477    reverseScript = new ReverseScript();
    477478
    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. */
    480480    public final Change diff_2(final boolean reverse) {
    481481        return diff(reverse ? reverseScript : forwardScript);
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r8855 r8928  
    876876     * Tests if the {@code node} is inside the multipolygon {@code multiPolygon}. The nullable argument
    877877     * {@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
    878882     */
    879883    public static boolean isNodeInsideMultiPolygon(Node node, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) {
     
    886890     * <p>
    887891     * 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
    888896     */
    889897    public static boolean isPolygonInsideMultiPolygon(List<Node> nodes, Relation multiPolygon, Predicate<Way> isOuterWayAMatch) {
  • trunk/src/org/openstreetmap/josm/tools/Predicates.java

    r8378 r8928  
    1818    /**
    1919     * Returns the negation of {@code predicate}.
     20     * @param predicate the predicate to negate
     21     * @return the negation of {@code predicate}
    2022     */
    2123    public static <T> Predicate<T> not(final Predicate<T> predicate) {
     
    3032    /**
    3133     * Returns a {@link Predicate} executing {@link Objects#equals}.
     34     * @param ref the reference object
     35     * @return a {@link Predicate} executing {@link Objects#equals}
    3236     */
    3337    public static <T> Predicate<T> equalTo(final T ref) {
     
    4246    /**
    4347     * 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}
    4450     */
    4551    public static Predicate<String> stringMatchesPattern(final Pattern pattern) {
     
    5460    /**
    5561     * 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}
    5664     */
    5765    public static Predicate<String> stringContainsPattern(final Pattern pattern) {
     
    6674    /**
    6775     * Returns a {@link Predicate} executing {@link String#contains(CharSequence)}.
     76     * @param pattern the pattern
     77     * @return a {@link Predicate} executing {@link String#contains(CharSequence)}
    6878     */
    6979    public static Predicate<String> stringContains(final String pattern) {
     
    7888    /**
    7989     * 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...)}
    8093     */
    8194    public static Predicate<OsmPrimitive> hasTag(final String key, final String... values) {
     
    90103    /**
    91104     * Returns a {@link Predicate} executing {@link OsmPrimitive#hasKey(String)}.
     105     * @param key the key
     106     * @return a {@link Predicate} executing {@link OsmPrimitive#hasKey(String)}
    92107     */
    93108    public static Predicate<OsmPrimitive> hasKey(final String key) {
     
    102117    /**
    103118     * Returns a {@link Predicate} executing {@link Collection#contains(Object)}.
     119     * @param target collection
     120     * @return a {@link Predicate} executing {@link Collection#contains(Object)}
    104121     */
    105122    public static <T> Predicate<T> inCollection(final Collection<? extends T> target) {
     
    114131    /**
    115132     * Returns a {@link Predicate} testing whether objects are {@code null}.
     133     * @return a {@link Predicate} testing whether objects are {@code null}
    116134     */
    117135    public static <T> Predicate<T> isNull() {
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r8846 r8928  
    152152    /**
    153153     * Use this to register the shortcut with Swing
     154     * @return the key stroke
    154155     */
    155156    public KeyStroke getKeyStroke() {
     
    233234
    234235    /**
    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
    236238     */
    237239    public String getKeyText() {
     
    270272
    271273    /**
    272      * FOR PREF PANE ONLY
     274     * Returns a list of all shortcuts.
     275     * @return a list of all shortcuts
    273276     */
    274277    public static List<Shortcut> listAll() {
     
    384387
    385388    /**
    386      * FOR PLATFORMHOOK USE ONLY
    387      *
     389     * FOR PLATFORMHOOK USE ONLY.
     390     * <p>
    388391     * 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
    389398     */
    390399    public static Shortcut registerSystemShortcut(String shortText, String longText, int key, int modifier) {
     
    416425     * @param requestedGroup the group this shortcut fits best. This will determine the
    417426     * modifiers your shortcut will get assigned. Use the constants defined above.
     427     * @return the shortcut
    418428     */
    419429    public static Shortcut registerShortcut(String shortText, String longText, int requestedKey, int requestedGroup) {
  • trunk/src/org/openstreetmap/josm/tools/TextTagParser.java

    r8846 r8928  
    5555        /**
    5656         * Read tags from "Free format"
     57         * @return map of tags
    5758         */
    58         Map<String, String> getFreeParsedTags() {
     59        private Map<String, String> getFreeParsedTags() {
    5960            String k, v;
    6061            Map<String, String> tags = new HashMap<>();
     
    168169     * @param tagRegex - each part is matched against this regex
    169170     * @param unescapeTextInQuotes - if true, matched tag and value will be analyzed more thoroughly
     171     * @return map of tags
    170172     */
    171173    public static Map<String, String> readTagsByRegexp(String text, String splitRegex, String tagRegex, boolean unescapeTextInQuotes) {
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r8926 r8928  
    8888
    8989    /**
    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}
    9194     */
    9295    public static <T> boolean exists(Iterable<? extends T> collection, Predicate<? super T> predicate) {
     
    100103    /**
    101104     * 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}
    102108     */
    103109    public static <T> boolean forAll(Iterable<? extends T> collection, Predicate<? super T> predicate) {
     
    152158     * Filter a collection by (sub)class.
    153159     * 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
    154163     */
    155164    public static <S, T extends S> SubclassFilteredCollection<S, T> filteredCollection(Collection<S> collection, final Class<T> klass) {
     
    281290     * convert Color to String
    282291     * (Color.toString() omits alpha value)
     292     * @param c the color
     293     * @return the String representation, including alpha
    283294     */
    284295    public static String toString(Color c) {
     
    308319     * convert integer range 0..255 to float range 0 &lt;= x &lt;= 1
    309320     * when dealing with colors and color alpha value
     321     * @param val integer value
     322     * @return corresponding float value in range 0 &lt;= x &lt;= 1
    310323     */
    311324    public static Float color_int2float(Integer val) {
Note: See TracChangeset for help on using the changeset viewer.