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/TransformNodesCommand.java

    r8443 r8456  
    2828     */
    2929    protected Collection<Node> nodes = new LinkedList<>();
    30 
    3130
    3231    /**
     
    140139
    141140    }
     141
     142    @Override
     143    public int hashCode() {
     144        final int prime = 31;
     145        int result = super.hashCode();
     146        result = prime * result + ((nodes == null) ? 0 : nodes.hashCode());
     147        result = prime * result + ((oldStates == null) ? 0 : oldStates.hashCode());
     148        return result;
     149    }
     150
     151    @Override
     152    public boolean equals(Object obj) {
     153        if (this == obj)
     154            return true;
     155        if (!super.equals(obj))
     156            return false;
     157        if (getClass() != obj.getClass())
     158            return false;
     159        TransformNodesCommand other = (TransformNodesCommand) obj;
     160        if (nodes == null) {
     161            if (other.nodes != null)
     162                return false;
     163        } else if (!nodes.equals(other.nodes))
     164            return false;
     165        if (oldStates == null) {
     166            if (other.oldStates != null)
     167                return false;
     168        } else if (!oldStates.equals(other.oldStates))
     169            return false;
     170        return true;
     171    }
    142172}
Note: See TracChangeset for help on using the changeset viewer.