Ignore:
Timestamp:
2014-03-10T02:33:20+01:00 (5 years ago)
Author:
Don-vip
Message:

refactor duplicated code - impacts some plugins (reverter, roadsigns, cmdline)

Location:
trunk/src/org/openstreetmap/josm/data/coor
Files:
2 edited

Legend:

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

    r6380 r6906  
    113113    }
    114114
    115     @Override
    116     public int hashCode() {
     115    protected final int computeHashCode(int init) {
    117116        final int prime = 31;
    118         int result = 1;
     117        int result = init;
    119118        long temp;
    120119        temp = java.lang.Double.doubleToLongBits(x);
     
    123122        result = prime * result + (int) (temp ^ (temp >>> 32));
    124123        return result;
     124    }
     125
     126    @Override
     127    public int hashCode() {
     128        return computeHashCode(1);
    125129    }
    126130
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r6883 r6906  
    410410    @Override
    411411    public int hashCode() {
    412         final int prime = 31;
    413         int result = super.hashCode();
    414         long temp;
    415         temp = java.lang.Double.doubleToLongBits(x);
    416         result = prime * result + (int) (temp ^ (temp >>> 32));
    417         temp = java.lang.Double.doubleToLongBits(y);
    418         result = prime * result + (int) (temp ^ (temp >>> 32));
    419         return result;
     412        return computeHashCode(super.hashCode());
    420413    }
    421414
Note: See TracChangeset for help on using the changeset viewer.