Changeset 8459 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2015-06-03T13:24:59+02:00 (9 years ago)
Author:
Don-vip
Message:

javadoc / Unit test fixes

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r8443 r8459  
    3838 * Case 4.1: Only nodes selected, part of a non-closed way: align these nodes on the line passing through the
    3939 *   extremity nodes (most distant in the way sequence). See https://josm.openstreetmap.de/ticket/9605#comment:3
    40  * Case 4.2: Only nodes selected, part of a closed way: align these nodes on the line passing through the most distant
    41  *   nodes.
    42  * Case 4.3: Only nodes selected, part of multiple ways: align these nodes on the line passing through the most distant
    43  *   nodes.
     40 * Case 4.2: Only nodes selected, part of a closed way: align these nodes on the line passing through the most distant nodes.
     41 * Case 4.3: Only nodes selected, part of multiple ways: align these nodes on the line passing through the most distant nodes.
    4442 * </pre>
    4543 *
     
    8583     */
    8684    private Node[] nodePairFurthestApart(List<Node> nodes) {
    87         Node nodea = null;
    88         Node nodeb = null;
    89 
    9085        // Detect if selected nodes are on the same way.
    9186
     
    111106            return nodeFurthestAppart(nodes);
    112107        }
     108
     109        Node nodea = null;
     110        Node nodeb = null;
    113111
    114112        // The way is open, align nodes on the line passing through the extremity nodes (most distant in the way
     
    231229     * @param ways Collection of way to align
    232230     * @return Command that perform action
    233      * @throws InvalidSelection
     231     * @throws InvalidSelection if a polygon is selected, or if a node is used by 3 or more ways
    234232     */
    235233    private Command alignMultiWay(Collection<Way> ways) throws InvalidSelection {
     
    268266     * @param refWays Ways where useful lines will be searched
    269267     * @return List of useful lines
    270      * @throws InvalidSelection
     268     * @throws InvalidSelection if a node got more than 4 neighbours (self-crossing way)
    271269     */
    272270    private List<Line> getInvolvedLines(Node node, List<Way> refWays) throws InvalidSelection {
     
    314312                }
    315313            } else
    316                 throw new InvalidSelection();
     314                throw new InvalidSelection("cannot treat more than 4 neighbours, got "+neighbors.size());
    317315        }
    318316        return lines;
     
    324322     * @param lines Lines to align node on
    325323     * @return Command that perform action
    326      * @throws InvalidSelection
     324     * @throws InvalidSelection if more than 2 lines
    327325     */
    328326    private Command alignSingleNode(Node node, List<Line> lines) throws InvalidSelection {
     
    351349        /**
    352350         * Init a line by 2 nodes.
    353          * @param first On point of the line
     351         * @param first One point of the line
    354352         * @param last Other point of the line
    355          * @throws InvalidSelection
     353         * @throws InvalidSelection if nodes have same coordinates
    356354         */
    357355        public Line(Node first, Node last) throws InvalidSelection {
     
    364362            double norm = Math.sqrt(a*a + b*b);
    365363            if (norm == 0)
    366                 // Nodes have same coordinates !
    367                 throw new InvalidSelection();
     364                throw new InvalidSelection("Nodes have same coordinates!");
    368365            a /= norm;
    369366            b /= norm;
     
    374371         * Init a line equation from a way.
    375372         * @param way Use extremity of this way to compute line equation
    376          * @throws InvalidSelection
     373         * @throws InvalidSelection if nodes have same coordinates
    377374         */
    378375        public Line(Way way) throws InvalidSelection {
     
    395392         * @param other Second line for intersection
    396393         * @return The command that move the node
    397          * @throws InvalidSelection
     394         * @throws InvalidSelection if two parallels ways found
    398395         */
    399396        public Command intersectionCommand(Node n, Line other) throws InvalidSelection {
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r8443 r8459  
    9696     * Combine multiple ways into one.
    9797     * @param ways the way to combine to one way
    98      * @return null if ways cannot be combined. Otherwise returns the combined
    99      *              ways and the commands to combine
    100      * @throws UserCancelException
     98     * @return null if ways cannot be combined. Otherwise returns the combined ways and the commands to combine
     99     * @throws UserCancelException if the user cancelled a dialog.
    101100     */
    102101    public static Pair<Way, Command> combineWaysWorker(Collection<Way> ways) throws UserCancelException {
     
    111110        ways = new LinkedHashSet<>(ways);
    112111
    113         // try to build a new way which includes all the combined
    114         // ways
     112        // try to build a new way which includes all the combined ways
    115113        //
    116114        NodeGraph graph = NodeGraph.createNearlyUndirectedGraphFromNodeWays(ways);
     
    641639            // graph built up from way segments is likely to include such
    642640            // nodes, unless all ways are closed.
    643             // In the worst case this loops over all nodes which is
    644             // very slow for large ways.
     641            // In the worst case this loops over all nodes which is very slow for large ways.
    645642            //
    646643            Set<Node> nodes = getTerminalNodes();
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r8449 r8459  
    10021002     * Collects outer way and corresponding inner ways from all boundaries.
    10031003     * @param level depth level
    1004      * @param boundaryWays
    1005      * @return the outermostWay.
     1004     * @param boundaryWays list of joined boundaries to search in
     1005     * @return the outermost Way.
    10061006     */
    10071007    private List<PolygonLevel> findOuterWaysImpl(int level, Collection<AssembledPolygon> boundaryWays) {
  • trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java

    r8308 r8459  
    8080     * Restore the current history from the preferences
    8181     *
    82      * @param cbHistory
     82     * @param cbHistory the history combo box
    8383     */
    8484    protected void restoreUploadAddressHistory(HistoryComboBox cbHistory) {
     
    9393    /**
    9494     * Remind the current history in the preferences
    95      * @param cbHistory
     95     * @param cbHistory the history combo box
    9696     */
    9797    protected void remindUploadAddressHistory(HistoryComboBox cbHistory) {
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r8443 r8459  
    419419         * heading of the entire way.
    420420         * @param pInitialDirection initial direction
    421          * @throws InvalidUserInputException
     421         * @throws InvalidUserInputException if selected ways have an angle different from 90 or 180 degrees
    422422         */
    423423        public void calcDirections(Direction pInitialDirection) throws InvalidUserInputException {
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r8390 r8459  
    7575    /**
    7676     * Restarts the current Java application
    77      * @throws IOException
     77     * @throws IOException in case of any error
    7878     */
    7979    public static void restartJOSM() throws IOException {
  • trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java

    r8443 r8459  
    166166     *
    167167     * @param w the way to simplify
     168     * @param threshold the max error threshold
    168169     * @return The sequence of commands to run
    169170     * @since 6411
     
    187188            }
    188189            // ... and simplify them
    189             buildSimplifiedNodeList(w.getNodes(), lower, Math.min(w.getNodesCount()-1, i), threshold,newNodes);
     190            buildSimplifiedNodeList(w.getNodes(), lower, Math.min(w.getNodesCount()-1, i), threshold, newNodes);
    190191            lower=i;
    191192            i++;
     
    214215     * @param from the lower index
    215216     * @param to the upper index
    216      * @param threshold
     217     * @param threshold the max error threshold
    217218     */
    218219    protected void buildSimplifiedNodeList(List<Node> wnew, int from, int to, double threshold, List<Node> simplifiedNodes) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWays.java

    r8378 r8459  
    126126    /**
    127127     * Offsets the way(s) d units. Positive d means to the left (relative to the reference way)
    128      * @param d
     128     * @param d offset
    129129     */
    130130    public void changeOffset(double d) {
  • trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java

    r8433 r8459  
    114114    /**
    115115     * @param cache cache instance that we will work on
    116      * @param headers
    117      * @param readTimeout
    118      * @param connectTimeout
    119      * @param downloadJobExecutor
     116     * @param headers HTTP headers to be sent together with request
     117     * @param readTimeout when connecting to remote resource
     118     * @param connectTimeout when connecting to remote resource
     119     * @param downloadJobExecutor that will be executing the jobs
    120120     */
    121121    public JCSCachedTileLoaderJob(ICacheAccess<K,V> cache,
     
    134134    /**
    135135     * @param cache cache instance that we will work on
    136      * @param headers
    137      * @param readTimeout
    138      * @param connectTimeout
     136     * @param headers HTTP headers to be sent together with request
     137     * @param readTimeout when connecting to remote resource
     138     * @param connectTimeout when connecting to remote resource
    139139     */
    140140    public JCSCachedTileLoaderJob(ICacheAccess<K, V> cache,
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r8456 r8459  
    10231023
    10241024    /**
    1025      * Sets the Map of &lt;header name, header value&gt; that if any of this header
     1025     * Sets the map of &lt;header name, header value&gt; that if any of this header
    10261026     * will be returned, then this tile will be treated as "no tile at this zoom level"
    10271027     *
    1028      * @param noTileHeaders
     1028     * @param noTileHeaders Map of &lt;header name, header value&gt; which will be treated as "no tile at this zoom level"
    10291029     * @since 8344
    10301030     */
     
    10391039
    10401040    /**
    1041      * Returns the map &lt;header name, metadata key&gt; indicating, which HTTP headers should
     1041     * Returns the map of &lt;header name, metadata key&gt; indicating, which HTTP headers should
    10421042     * be moved to metadata
    10431043     *
    1044      * @param metadataHeaders
     1044     * @param metadataHeaders map of &lt;header name, metadata key&gt; indicating, which HTTP headers should be moved to metadata
    10451045     * @since 8418
    10461046     */
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoader.java

    r8403 r8459  
    2929public class TMSCachedTileLoader implements TileLoader, CachedTileLoader, TileCache {
    3030
    31     private ICacheAccess<String, BufferedImageCacheEntry> cache;
    32     private int connectTimeout;
    33     private int readTimeout;
    34     private Map<String, String> headers;
    35     private TileLoaderListener listener;
     31    private final ICacheAccess<String, BufferedImageCacheEntry> cache;
     32    private final int connectTimeout;
     33    private final int readTimeout;
     34    private final Map<String, String> headers;
     35    private final TileLoaderListener listener;
    3636    private static final String PREFERENCE_PREFIX   = "imagery.tms.cache.";
     37
    3738    /**
    38      * how many object on disk should be stored for TMS region. Average tile size is about 20kb
     39     * how many object on disk should be stored for TMS region. Average tile size is about 20kb. 25000 is around 500MB under this assumption
    3940     */
    40     public static final IntegerProperty MAX_OBJECTS_ON_DISK = new IntegerProperty(PREFERENCE_PREFIX + "max_objects_disk", 25000); // 25000 is around 500MB under this assumptions
     41    public static final IntegerProperty MAX_OBJECTS_ON_DISK = new IntegerProperty(PREFERENCE_PREFIX + "max_objects_disk", 25000);
    4142
    4243    /**
     
    5051    public static final IntegerProperty HOST_LIMIT = new IntegerProperty("imagery.tms.tmsloader.maxjobsperhost", 6);
    5152
    52 
    5353    /**
    5454     * separate from JCS thread pool for TMS loader, so we can have different thread pools for default JCS
     
    5656     */
    5757    private static ThreadPoolExecutor DEFAULT_DOWNLOAD_JOB_DISPATCHER = getThreadPoolExecutor();
     58
     59    private final ThreadPoolExecutor downloadExecutor = DEFAULT_DOWNLOAD_JOB_DISPATCHER;
    5860
    5961    private static ThreadPoolExecutor getThreadPoolExecutor() {
     
    6870    }
    6971
    70     private ThreadPoolExecutor downloadExecutor = DEFAULT_DOWNLOAD_JOB_DISPATCHER;
    71 
    7272    /**
    7373     * Constructor
     
    7676     * @param connectTimeout    to remote resource
    7777     * @param readTimeout       to remote resource
    78      * @param headers           to be sent along with request
     78     * @param headers           HTTP headers to be sent along with request
    7979     * @param cacheDir          where cache file shall reside
    8080     * @throws IOException      when cache initialization fails
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r8433 r8459  
    5252    /**
    5353     * Constructor for creating a job, to get a specific tile from cache
    54      * @param listener
     54     * @param listener Tile loader listener
    5555     * @param tile to be fetched from cache
    5656     * @param cache object
    5757     * @param connectTimeout when connecting to remote resource
    5858     * @param readTimeout when connecting to remote resource
    59      * @param headers to be sent together with request
     59     * @param headers HTTP headers to be sent together with request
    6060     * @param downloadExecutor that will be executing the jobs
    6161     */
  • trunk/src/org/openstreetmap/josm/gui/FileDrop.java

    r8443 r8459  
    3434import org.openstreetmap.josm.Main;
    3535import org.openstreetmap.josm.actions.OpenFileAction;
     36import org.openstreetmap.josm.gui.FileDrop.TransferableObject;
    3637
    3738/**
     
    538539         * {@link #DATA_FLAVOR}.
    539540         *
     541         * @param fetcher The {@link Fetcher} that will return the data object
    540542         * @see Fetcher
    541          * @param fetcher The {@link Fetcher} that will return the data object
    542543         */
    543544        public TransferableObject(Fetcher fetcher) {
  • trunk/src/org/openstreetmap/josm/gui/MenuScroller.java

    r8441 r8459  
    151151     * @param interval the scroll interval, in milliseconds
    152152     * @param topFixedCount the number of items to fix at the top.  May be 0.
     153     * @return the MenuScroller
    153154     * @throws IllegalArgumentException if scrollCount or interval is 0 or
    154155     * negative or if topFixedCount is negative
    155      * @return the MenuScroller
    156156     * @since 7463
    157157     */
     
    167167     * @param interval the scroll interval, in milliseconds
    168168     * @param topFixedCount the number of items to fix at the top. May be 0
     169     * @return the MenuScroller
    169170     * @throws IllegalArgumentException if scrollCount or interval is 0 or
    170171     * negative or if topFixedCount is negative
    171      * @return the MenuScroller
    172172     * @since 7463
    173173     */
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r8443 r8459  
    822822     *
    823823     * Finally, if a node is not found at all, null is returned.
    824      * @since 6065
    825      * @return A node within snap-distance to point p,
    826      *      that is chosen by the algorithm described.
    827824     *
    828825     * @param p the screen point
     
    830827     *        give the nearest node that is tagged.
    831828     * @param preferredRefs primitives, whose nodes we prefer
     829     *
     830     * @return A node within snap-distance to point p,
     831     *      that is chosen by the algorithm described.
     832     * @since 6065
    832833     */
    833834    public final Node getNearestNode(Point p, Predicate<OsmPrimitive> predicate,
     
    10091010     * The *result* depends on the current map selection state IF use_selected is true.
    10101011     *
     1012     * @param p the point for which to search the nearest segment.
     1013     * @param predicate the returned object has to fulfill certain properties.
     1014     * @param useSelected whether selected way segments should be preferred.
     1015     *
    10111016     * @return The nearest way segment to point p,
    10121017     *      and, depending on use_selected, prefers a selected way segment, if found.
    10131018     * @see #getNearestWaySegments(Point, Collection, Predicate)
    1014      *
    1015      * @param p the point for which to search the nearest segment.
    1016      * @param predicate the returned object has to fulfill certain properties.
    1017      * @param useSelected whether selected way segments should be preferred.
    10181019     */
    10191020    public final WaySegment getNearestWaySegment(Point p, Predicate<OsmPrimitive> predicate, boolean useSelected) {
     
    10401041     * The *result* depends on the current map selection state IF use_selected is true.
    10411042     *
    1042      * @return The nearest way segment to point p,
    1043      *      and, depending on use_selected, prefers a selected way segment, if found.
    1044      * Also prefers segments of ways that are related to one of preferredRefs primitives
    1045      * @see #getNearestWaySegments(Point, Collection, Predicate)
    1046      * @since 6065
    10471043     * @param p the point for which to search the nearest segment.
    10481044     * @param predicate the returned object has to fulfill certain properties.
    10491045     * @param use_selected whether selected way segments should be preferred.
    10501046     * @param preferredRefs - prefer segments related to these primitives, may be null
     1047     *
     1048     * @return The nearest way segment to point p,
     1049     *      and, depending on use_selected, prefers a selected way segment, if found.
     1050     * Also prefers segments of ways that are related to one of preferredRefs primitives
     1051     *
     1052     * @see #getNearestWaySegments(Point, Collection, Predicate)
     1053     * @since 6065
    10511054     */
    10521055    public final WaySegment getNearestWaySegment(Point p, Predicate<OsmPrimitive> predicate,
     
    11501153     * The *result* depends on the current map selection state.
    11511154     *
    1152      * @return The nearest way to point p,
    1153      *      prefer a selected way if there are multiple nearest.
    1154      * @see #getNearestWaySegment(Point, Predicate)
    1155      *
    11561155     * @param p the point for which to search the nearest segment.
    11571156     * @param predicate the returned object has to fulfill certain properties.
     1157     *
     1158     * @return The nearest way to point p, prefer a selected way if there are multiple nearest.
     1159     * @see #getNearestWaySegment(Point, Predicate)
    11581160     */
    11591161    public final Way getNearestWay(Point p, Predicate<OsmPrimitive> predicate) {
     
    12491251     * Finally, if no nearest primitive is found at all, return null.
    12501252     *
     1253     * @param p The point on screen.
     1254     * @param predicate the returned object has to fulfill certain properties.
     1255     * @param use_selected whether to prefer primitives that are currently selected or referred by selected primitives
     1256     *
    12511257     * @return A primitive within snap-distance to point p,
    12521258     *      that is chosen by the algorithm described.
    12531259     * @see #getNearestNode(Point, Predicate)
    12541260     * @see #getNearestWay(Point, Predicate)
    1255      *
    1256      * @param p The point on screen.
    1257      * @param predicate the returned object has to fulfill certain properties.
    1258      * @param use_selected whether to prefer primitives that are currently selected or referred by selected primitives
    12591261     */
    12601262    public final OsmPrimitive getNearestNodeOrWay(Point p, Predicate<OsmPrimitive> predicate, boolean use_selected) {
     
    13461348
    13471349    /**
    1348      * The *result* does not depend on the current map selection state,
    1349      * neither does the result *order*.
     1350     * The *result* does not depend on the current map selection state, neither does the result *order*.
    13501351     * It solely depends on the distance to point p.
    1351      *
    1352      * @return a list of all objects that are nearest to point p and
    1353      *          not in ignore or an empty list if nothing was found.
    13541352     *
    13551353     * @param p The point on screen.
    13561354     * @param ignore a collection of ways which are not to be returned.
    13571355     * @param predicate the returned object has to fulfill certain properties.
     1356     *
     1357     * @return a list of all objects that are nearest to point p and
     1358     *          not in ignore or an empty list if nothing was found.
    13581359     */
    13591360    public final List<OsmPrimitive> getAllNearest(Point p,
     
    13951396
    13961397    /**
    1397      * The *result* does not depend on the current map selection state,
    1398      * neither does the result *order*.
     1398     * The *result* does not depend on the current map selection state, neither does the result *order*.
    13991399     * It solely depends on the distance to point p.
     1400     *
     1401     * @param p The point on screen.
     1402     * @param predicate the returned object has to fulfill certain properties.
    14001403     *
    14011404     * @return a list of all objects that are nearest to point p
    14021405     *          or an empty list if nothing was found.
    14031406     * @see #getAllNearest(Point, Collection, Predicate)
    1404      *
    1405      * @param p The point on screen.
    1406      * @param predicate the returned object has to fulfill certain properties.
    14071407     */
    14081408    public final List<OsmPrimitive> getAllNearest(Point p, Predicate<OsmPrimitive> predicate) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Environment.java

    r8419 r8459  
    148148     * @param count count of nodes in parent way or members in parent relation
    149149     * @return A clone of this environment, with the specified child, index, and context set to {@code Context#LINK}
    150      * @since 6175
    151150     * @see #child
    152151     * @see #index
     152     * @since 6175
    153153     */
    154154    public Environment withChildAndIndexAndLinkContext(OsmPrimitive child, int index, int count) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r8440 r8459  
    578578         * {@code sw}, {@code southwest}, {@code w}, {@code west}, {@code nw}, {@code northwest}.
    579579         * @param cardinal the angle in cardinal directions.
     580         * @return the angle in radians
    580581         * @see RotationAngle#parseCardinalRotation(String)
    581          * @return the angle in radians
    582582         */
    583583        public static Double cardinal_to_radians(String cardinal) {
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r8449 r8459  
    411411     * @return segmentP1 if it is the closest point, segmentP2 if it is the closest point,
    412412     * a new point if closest point is between segmentP1 and segmentP2.
     413     * @see #closestPointToLine
    413414     * @since 3650
    414      * @see #closestPointToLine
    415415     */
    416416    public static EastNorth closestPointToSegment(EastNorth segmentP1, EastNorth segmentP2, EastNorth point) {
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r8443 r8459  
    381381     * Set image width
    382382     * @param width final width of the image
     383     * @return the current object, for convenience
    383384     * @see #setSize
    384      * @return the current object, for convenience
    385385     */
    386386    public ImageProvider setWidth(int width) {
     
    392392     * Set image height
    393393     * @param height final height of the image
     394     * @return the current object, for convenience
    394395     * @see #setSize
    395      * @return the current object, for convenience
    396396     */
    397397    public ImageProvider setHeight(int height) {
     
    13531353     * @throws IllegalArgumentException if <code>input</code> is <code>null</code>.
    13541354     * @throws IOException if an error occurs during reading.
     1355     * @see BufferedImage#getProperty
    13551356     * @since 7132
    1356      * @see BufferedImage#getProperty
    13571357     */
    13581358    public static BufferedImage read(File input, boolean readMetadata, boolean enforceTransparency) throws IOException {
Note: See TracChangeset for help on using the changeset viewer.