Ignore:
Timestamp:
2017-04-13T01:08:58+02:00 (3 years ago)
Author:
Don-vip
Message:

sonar - squid:S1126 - Return of boolean expressions should not be wrapped into an "if-then-else" statement

File:
1 edited

Legend:

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

    r10906 r11893  
    2626    public int dir;
    2727
     28    /**
     29     * Constructs a new {@code WayPoint} from an existing one.
     30     * @param p existing waypoint
     31     */
    2832    public WayPoint(WayPoint p) {
    2933        attr.putAll(p.attr);
     
    3842    }
    3943
     44    /**
     45     * Constructs a new {@code WayPoint} from lat/lon coordinates.
     46     * @param ll lat/lon coordinates
     47     */
    4048    public WayPoint(LatLon ll) {
    4149        lat = ll.lat();
     
    6472    }
    6573
     74    /**
     75     * Returns the waypoint coordinates.
     76     * @return the waypoint coordinates
     77     */
    6678    public final LatLon getCoor() {
    6779        return new LatLon(lat, lon);
     
    138150    }
    139151
     152    /**
     153     * Returns the waypoint time.
     154     * @return the waypoint time
     155     */
    140156    public Date getTime() {
    141157        return new Date((long) (time * 1000));
     
    177193        if (this == obj)
    178194            return true;
    179         if (!super.equals(obj))
    180             return false;
    181         if (getClass() != obj.getClass())
     195        if (obj == null || !super.equals(obj) || getClass() != obj.getClass())
    182196            return false;
    183197        WayPoint other = (WayPoint) obj;
    184         if (Double.doubleToLongBits(lat) != Double.doubleToLongBits(other.lat))
    185             return false;
    186         if (Double.doubleToLongBits(lon) != Double.doubleToLongBits(other.lon))
    187             return false;
    188         if (Double.doubleToLongBits(time) != Double.doubleToLongBits(other.time))
    189             return false;
    190         return true;
     198        return Double.doubleToLongBits(lat) == Double.doubleToLongBits(other.lat)
     199            && Double.doubleToLongBits(lon) == Double.doubleToLongBits(other.lon)
     200            && Double.doubleToLongBits(time) == Double.doubleToLongBits(other.time);
    191201    }
    192202}
Note: See TracChangeset for help on using the changeset viewer.