Changes in / [6162:6168] in josm


Ignore:
Location:
/trunk/src/org/openstreetmap/josm/data
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • /trunk/src/org/openstreetmap/josm/data/Preferences.java

    r6162 r6168  
    963963        List<List<String>> prop = arrayProperties.get(key);
    964964        if (prop != null) {
    965             @SuppressWarnings("unchecked")
     965            @SuppressWarnings({ "unchecked", "rawtypes" })
    966966            Collection<Collection<String>> prop_cast = (Collection) prop;
    967967            return prop_cast;
     
    974974        List<List<String>> prop = arrayProperties.get(key);
    975975        if (prop != null) {
    976             @SuppressWarnings("unchecked")
     976            @SuppressWarnings({ "unchecked", "rawtypes" })
    977977            Collection<Collection<String>> prop_cast = (Collection) prop;
    978978            return prop_cast;
     
    982982
    983983    public boolean putArray(String key, Collection<Collection<String>> value) {
    984         boolean changed = false;
     984        //boolean changed = false;
    985985
    986986        List<List<String>> oldValue = null;
  • /trunk/src/org/openstreetmap/josm/data/coor/Coordinate.java

    r6162 r6168  
    1414 * EastNorth.
    1515 *
    16  * @author imi
     16 * @since 6162
    1717 */
    18 abstract class Coordinate implements Serializable {
     18abstract class Coordinate implements Cloneable, Serializable {
    1919
    2020    protected final double x;
     
    3939    }
    4040
     41    /**
     42     * Returns the euclidean distance from this {@code Coordinate} to a specified {@code Coordinate}.
     43     *
     44     * @param coor the specified coordinate to be measured against this {@code Coordinate}
     45     * @return the euclidean distance from this {@code Coordinate} to a specified {@code Coordinate}
     46     * @since 6166
     47     */
     48    protected final double distance(final Coordinate coor) {
     49        return distance(coor.x, coor.y);
     50    }
     51   
     52    /**
     53     * Returns the euclidean distance from this {@code Coordinate} to a specified coordinate.
     54     *
     55     * @param px the X coordinate of the specified point to be measured against this {@code Coordinate}
     56     * @param py the Y coordinate of the specified point to be measured against this {@code Coordinate}
     57     * @return the euclidean distance from this {@code Coordinate} to a specified coordinate
     58     * @since 6166
     59     */
     60    public final double distance(final double px, final double py) {
     61        final double dx = this.x-px;
     62        final double dy = this.y-py;
     63        return Math.sqrt(dx*dx + dy*dy);
     64    }
     65   
     66    /**
     67     * Returns the square of the euclidean distance from this {@code Coordinate} to a specified {@code Coordinate}.
     68     *
     69     * @param coor the specified coordinate to be measured against this {@code Coordinate}
     70     * @return the square of the euclidean distance from this {@code Coordinate} to a specified {@code Coordinate}
     71     * @since 6166
     72     */
     73    protected final double distanceSq(final Coordinate coor) {
     74        return distanceSq(coor.x, coor.y);
     75    }
     76
     77    /**
     78     * Returns the square of euclidean distance from this {@code Coordinate} to a specified coordinate.
     79     *
     80     * @param px the X coordinate of the specified point to be measured against this {@code Coordinate}
     81     * @param py the Y coordinate of the specified point to be measured against this {@code Coordinate}
     82     * @return the square of the euclidean distance from this {@code Coordinate} to a specified coordinate
     83     * @since 6166
     84     */
     85    public final double distanceSq(final double px, final double py) {
     86        final double dx = this.x-px;
     87        final double dy = this.y-py;
     88        return dx*dx + dy*dy;
     89    }
     90
    4191    @Override
    4292    public int hashCode() {
     
    55105        if (this == obj)
    56106            return true;
    57         if (!super.equals(obj))
    58             return false;
    59107        if (getClass() != obj.getClass())
    60108            return false;
  • /trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java

    r6162 r6168  
    4545
    4646    /**
    47      * Counts euclidean distance between this and other EastNorth.
     47     * Returns the euclidean distance from this {@code EastNorth} to a specified {@code EastNorth}.
    4848     *
    49      * @param en2 other EastNorth
    50      * @return distance between this and other EastNorth
     49     * @param en the specified coordinate to be measured against this {@code EastNorth}
     50     * @return the euclidean distance from this {@code EastNorth} to a specified {@code EastNorth}
     51     * @since 6166
    5152     */
    52     public double distance(final EastNorth en2) {
    53         final double dx = this.x-en2.x;
    54         final double dy = this.y-en2.y;
    55         return Math.sqrt(dx*dx + dy*dy);
     53    public double distance(final EastNorth en) {
     54        return super.distance(en);
    5655    }
    57 
     56   
    5857    /**
    59      * Counts square of euclidean distance between this and other EastNorth.
     58     * Returns the square of the euclidean distance from this {@code EastNorth} to a specified {@code EastNorth}.
    6059     *
    61      * @param en2 other EastNorth
    62      * @return square of distance between this and other EastNorth
     60     * @param en the specified coordinate to be measured against this {@code EastNorth}
     61     * @return the square of the euclidean distance from this {@code EastNorth} to a specified {@code EastNorth}
     62     * @since 6166
    6363     */
    64     public double distanceSq(final EastNorth en2) {
    65         final double dx = this.x-en2.x;
    66         final double dy = this.y-en2.y;
    67         return dx*dx + dy*dy;
     64    public double distanceSq(final EastNorth en) {
     65        return super.distanceSq(en);
    6866    }
    6967
     
    132130        return (Math.abs(x - other.x) < e && Math.abs(y - other.y) < e);
    133131    }
     132
     133    @Override
     134    public EastNorth clone() {
     135        return new EastNorth(x, y);
     136    }
    134137}
  • /trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r6162 r6168  
    2727 */
    2828public class LatLon extends Coordinate {
    29 
    3029
    3130    /**
     
    298297
    299298    /**
    300      * Counts euclidean distance between this and other LatLon.
     299     * Returns the euclidean distance from this {@code LatLon} to a specified {@code LatLon}.
    301300     *
    302      * @param ll2 other LatLon
    303      * @return distance between this and other LatLon
    304      */
    305    public double distance(final LatLon ll2) {
    306         final double dx = this.x-ll2.x;
    307         final double dy = this.y-ll2.y;
    308         return Math.sqrt(dx*dx + dy*dy);
    309     }
    310 
     301     * @param ll the specified coordinate to be measured against this {@code LatLon}
     302     * @return the euclidean distance from this {@code LatLon} to a specified {@code LatLon}
     303     * @since 6166
     304     */
     305    public double distance(final LatLon ll) {
     306        return super.distance(ll);
     307    }
     308   
     309    /**
     310     * Returns the square of the euclidean distance from this {@code LatLon} to a specified {@code LatLon}.
     311     *
     312     * @param ll the specified coordinate to be measured against this {@code LatLon}
     313     * @return the square of the euclidean distance from this {@code LatLon} to a specified {@code LatLon}
     314     * @since 6166
     315     */
     316    public double distanceSq(final LatLon ll) {
     317        return super.distanceSq(ll);
     318    }
     319   
    311320    @Override public String toString() {
    312321        return "LatLon[lat="+lat()+",lon="+lon()+"]";
     
    386395        return true;
    387396    }
     397
     398    @Override
     399    public LatLon clone() {
     400        return new LatLon(x, y);
     401    }
    388402}
Note: See TracChangeset for help on using the changeset viewer.