Changeset 34616 in osm for applications


Ignore:
Timestamp:
2018-09-02T19:25:17+02:00 (6 years ago)
Author:
donvip
Message:

fix error-prone warnings

Location:
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Coordinate.java

    r34084 r34616  
    2020    private transient Point2D.Double data;
    2121
     22    /**
     23     * Constructs a new {@code Coordinate}.
     24     * @param lat latitude in degrees
     25     * @param lon longitude in degrees
     26     */
    2227    public Coordinate(double lat, double lon) {
    2328        data = new Point2D.Double(lon, lat);
     
    6267    @Override
    6368    public int hashCode() {
    64         int hash = 3;
    65         hash = 61 * hash + Objects.hashCode(this.data);
    66         return hash;
     69        return Objects.hashCode(data);
    6770    }
    6871
    6972    @Override
    7073    public boolean equals(Object obj) {
    71         if (obj == null) {
     74        if (this == obj)
     75            return true;
     76        if (obj == null || !(obj instanceof Coordinate))
    7277            return false;
    73         }
    74         if (getClass() != obj.getClass()) {
    75             return false;
    76         }
    7778        final Coordinate other = (Coordinate) obj;
    78         return Objects.equals(this.data, other.data);
     79        return Objects.equals(data, other.data);
    7980    }
    8081}
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Projected.java

    r33286 r34616  
    5353    @Override
    5454    public int hashCode() {
    55         int hash = 3;
    56         hash = 61 * hash + Objects.hashCode(this.data);
    57         return hash;
     55        return Objects.hashCode(data);
    5856    }
    5957
    6058    @Override
    6159    public boolean equals(Object obj) {
    62         if (obj == null) {
     60        if (this == obj)
     61            return true;
     62        if (obj == null || !(obj instanceof Projected))
    6363            return false;
    64         }
    65         if (getClass() != obj.getClass()) {
    66             return false;
    67         }
    6864        final Projected other = (Projected) obj;
    69         return Objects.equals(this.data, other.data);
     65        return Objects.equals(data, other.data);
    7066    }
    7167}
    72 
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java

    r33286 r34616  
    1010import java.util.HashMap;
    1111import java.util.Map;
     12import java.util.Objects;
    1213import java.util.concurrent.Callable;
    1314
     
    340341        if (this == obj)
    341342            return true;
    342         if (obj == null)
     343        if (obj == null || !(obj instanceof Tile))
    343344            return false;
    344         if (getClass() != obj.getClass())
    345             return false;
    346         Tile other = (Tile) obj;
    347         if (xtile != other.xtile)
    348             return false;
    349         if (ytile != other.ytile)
    350             return false;
    351         if (zoom != other.zoom)
    352             return false;
    353         return getTileSource().equals(other.getTileSource());
     345        final Tile other = (Tile) obj;
     346        return xtile == other.xtile
     347            && ytile == other.ytile
     348            && zoom == other.zoom
     349            && Objects.equals(source, other.source);
    354350    }
    355351
     
    460456        loaded = false;
    461457    }
    462 
    463458}
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/ICoordinate.java

    r31429 r34616  
    22package org.openstreetmap.gui.jmapviewer.interfaces;
    33
     4/**
     5 * Latitude/Longitude coordinates.
     6 */
    47public interface ICoordinate {
    58
     9    /**
     10     * Returns latitude.
     11     * @return latitude in degrees
     12     */
    613    double getLat();
    714
     15    /**
     16     * Sets latitude.
     17     * @param lat latitude in degrees
     18     */
    819    void setLat(double lat);
    920
     21    /**
     22     * Returns longitude.
     23     * @return longitude in degrees
     24     */
    1025    double getLon();
    1126
     27    /**
     28     * Sets longitude.
     29     * @param lon longitude in degrees
     30     */
    1231    void setLon(double lon);
    1332}
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java

    r34177 r34616  
    190190            ec * Math.pow(Math.tan(Math.PI/4 + Math.asin(E * sinl)/2), E);
    191191        double df = 1/(1 - sinl) - ec * E * cosl/((1 - E * sinl) *
    192             (Math.sqrt(1 - E * E * sinl * sinl)));
     192            Math.sqrt(1 - E * E * sinl * sinl));
    193193
    194194        return f/df;
Note: See TracChangeset for help on using the changeset viewer.