Ignore:
Timestamp:
2015-06-03T04:36:57+02:00 (9 years ago)
Author:
Don-vip
Message:

see #11508 - override hashCode() and equals() in other commands as well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/ScaleCommand.java

    r8392 r8456  
    7878        return trn("Scale {0} node", "Scale {0} nodes", nodes.size(), nodes.size());
    7979    }
     80
     81    @Override
     82    public int hashCode() {
     83        final int prime = 31;
     84        int result = super.hashCode();
     85        result = prime * result + ((pivot == null) ? 0 : pivot.hashCode());
     86        long temp;
     87        temp = Double.doubleToLongBits(scalingFactor);
     88        result = prime * result + (int) (temp ^ (temp >>> 32));
     89        result = prime * result + ((startEN == null) ? 0 : startEN.hashCode());
     90        return result;
     91    }
     92
     93    @Override
     94    public boolean equals(Object obj) {
     95        if (this == obj)
     96            return true;
     97        if (!super.equals(obj))
     98            return false;
     99        if (getClass() != obj.getClass())
     100            return false;
     101        ScaleCommand other = (ScaleCommand) obj;
     102        if (pivot == null) {
     103            if (other.pivot != null)
     104                return false;
     105        } else if (!pivot.equals(other.pivot))
     106            return false;
     107        if (Double.doubleToLongBits(scalingFactor) != Double.doubleToLongBits(other.scalingFactor))
     108            return false;
     109        if (startEN == null) {
     110            if (other.startEN != null)
     111                return false;
     112        } else if (!startEN.equals(other.startEN))
     113            return false;
     114        return true;
     115    }
    80116}
Note: See TracChangeset for help on using the changeset viewer.