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

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

Location:
trunk/src/org/openstreetmap/josm/command/conflict
Files:
9 edited

Legend:

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

    r8444 r8456  
    8686        return ImageProvider.get(conflict.getMy().getDisplayType());
    8787    }
     88
     89    @Override
     90    public int hashCode() {
     91        final int prime = 31;
     92        int result = super.hashCode();
     93        result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
     94        return result;
     95    }
     96
     97    @Override
     98    public boolean equals(Object obj) {
     99        if (this == obj)
     100            return true;
     101        if (!super.equals(obj))
     102            return false;
     103        if (getClass() != obj.getClass())
     104            return false;
     105        ConflictAddCommand other = (ConflictAddCommand) obj;
     106        if (conflict == null) {
     107            if (other.conflict != null)
     108                return false;
     109        } else if (!conflict.equals(other.conflict))
     110            return false;
     111        return true;
     112    }
    88113}
  • trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java

    r8444 r8456  
    7979        reconstituteConflicts();
    8080    }
     81
     82    @Override
     83    public int hashCode() {
     84        final int prime = 31;
     85        int result = super.hashCode();
     86        result = prime * result + ((resolvedConflicts == null) ? 0 : resolvedConflicts.hashCode());
     87        return result;
     88    }
     89
     90    @Override
     91    public boolean equals(Object obj) {
     92        if (this == obj)
     93            return true;
     94        if (!super.equals(obj))
     95            return false;
     96        if (getClass() != obj.getClass())
     97            return false;
     98        ConflictResolveCommand other = (ConflictResolveCommand) obj;
     99        if (resolvedConflicts == null) {
     100            if (other.resolvedConflicts != null)
     101                return false;
     102        } else if (!resolvedConflicts.equals(other.resolvedConflicts))
     103            return false;
     104        return true;
     105    }
    81106}
  • trunk/src/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommand.java

    r6887 r8456  
    7676        modified.add(conflict.getMy());
    7777    }
     78
     79    @Override
     80    public int hashCode() {
     81        final int prime = 31;
     82        int result = super.hashCode();
     83        result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
     84        result = prime * result + ((decision == null) ? 0 : decision.hashCode());
     85        return result;
     86    }
     87
     88    @Override
     89    public boolean equals(Object obj) {
     90        if (this == obj)
     91            return true;
     92        if (!super.equals(obj))
     93            return false;
     94        if (getClass() != obj.getClass())
     95            return false;
     96        CoordinateConflictResolveCommand other = (CoordinateConflictResolveCommand) obj;
     97        if (conflict == null) {
     98            if (other.conflict != null)
     99                return false;
     100        } else if (!conflict.equals(other.conflict))
     101            return false;
     102        if (decision != other.decision)
     103            return false;
     104        return true;
     105    }
    78106}
  • trunk/src/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommand.java

    r7509 r8456  
    8888        modified.addAll(conflict.getMy().getReferrers());
    8989    }
     90
     91    @Override
     92    public int hashCode() {
     93        final int prime = 31;
     94        int result = super.hashCode();
     95        result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
     96        result = prime * result + ((decision == null) ? 0 : decision.hashCode());
     97        return result;
     98    }
     99
     100    @Override
     101    public boolean equals(Object obj) {
     102        if (this == obj)
     103            return true;
     104        if (!super.equals(obj))
     105            return false;
     106        if (getClass() != obj.getClass())
     107            return false;
     108        DeletedStateConflictResolveCommand other = (DeletedStateConflictResolveCommand) obj;
     109        if (conflict == null) {
     110            if (other.conflict != null)
     111                return false;
     112        } else if (!conflict.equals(other.conflict))
     113            return false;
     114        if (decision != other.decision)
     115            return false;
     116        return true;
     117    }
    90118}
  • trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java

    r6887 r8456  
    6464        modified.add(conflict.getMy());
    6565    }
     66
     67    @Override
     68    public int hashCode() {
     69        final int prime = 31;
     70        int result = super.hashCode();
     71        result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
     72        return result;
     73    }
     74
     75    @Override
     76    public boolean equals(Object obj) {
     77        if (this == obj)
     78            return true;
     79        if (!super.equals(obj))
     80            return false;
     81        if (getClass() != obj.getClass())
     82            return false;
     83        ModifiedConflictResolveCommand other = (ModifiedConflictResolveCommand) obj;
     84        if (conflict == null) {
     85            if (other.conflict != null)
     86                return false;
     87        } else if (!conflict.equals(other.conflict))
     88            return false;
     89        return true;
     90    }
    6691}
  • trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java

    r8444 r8456  
    9595        }
    9696    }
     97
     98    @Override
     99    public int hashCode() {
     100        final int prime = 31;
     101        int result = super.hashCode();
     102        result = prime * result + ((mergedMembers == null) ? 0 : mergedMembers.hashCode());
     103        result = prime * result + ((my == null) ? 0 : my.hashCode());
     104        result = prime * result + ((their == null) ? 0 : their.hashCode());
     105        return result;
     106    }
     107
     108    @Override
     109    public boolean equals(Object obj) {
     110        if (this == obj)
     111            return true;
     112        if (!super.equals(obj))
     113            return false;
     114        if (getClass() != obj.getClass())
     115            return false;
     116        RelationMemberConflictResolverCommand other = (RelationMemberConflictResolverCommand) obj;
     117        if (mergedMembers == null) {
     118            if (other.mergedMembers != null)
     119                return false;
     120        } else if (!mergedMembers.equals(other.mergedMembers))
     121            return false;
     122        if (my == null) {
     123            if (other.my != null)
     124                return false;
     125        } else if (!my.equals(other.my))
     126            return false;
     127        if (their == null) {
     128            if (other.their != null)
     129                return false;
     130        } else if (!their.equals(other.their))
     131            return false;
     132        return true;
     133    }
    97134}
  • trunk/src/org/openstreetmap/josm/command/conflict/TagConflictResolveCommand.java

    r8444 r8456  
    9797        modified.add(conflict.getMy());
    9898    }
     99
     100    @Override
     101    public int hashCode() {
     102        final int prime = 31;
     103        int result = super.hashCode();
     104        result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
     105        result = prime * result + ((mergeItems == null) ? 0 : mergeItems.hashCode());
     106        return result;
     107    }
     108
     109    @Override
     110    public boolean equals(Object obj) {
     111        if (this == obj)
     112            return true;
     113        if (!super.equals(obj))
     114            return false;
     115        if (getClass() != obj.getClass())
     116            return false;
     117        TagConflictResolveCommand other = (TagConflictResolveCommand) obj;
     118        if (conflict == null) {
     119            if (other.conflict != null)
     120                return false;
     121        } else if (!conflict.equals(other.conflict))
     122            return false;
     123        if (mergeItems == null) {
     124            if (other.mergeItems != null)
     125                return false;
     126        } else if (!mergeItems.equals(other.mergeItems))
     127            return false;
     128        return true;
     129    }
    99130}
  • trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java

    r6887 r8456  
    7373        modified.add(conflict.getMy());
    7474    }
     75
     76    @Override
     77    public int hashCode() {
     78        final int prime = 31;
     79        int result = super.hashCode();
     80        result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
     81        return result;
     82    }
     83
     84    @Override
     85    public boolean equals(Object obj) {
     86        if (this == obj)
     87            return true;
     88        if (!super.equals(obj))
     89            return false;
     90        if (getClass() != obj.getClass())
     91            return false;
     92        VersionConflictResolveCommand other = (VersionConflictResolveCommand) obj;
     93        if (conflict == null) {
     94            if (other.conflict != null)
     95                return false;
     96        } else if (!conflict.equals(other.conflict))
     97            return false;
     98        return true;
     99    }
    75100}
  • trunk/src/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommand.java

    r8444 r8456  
    7272        modified.add(conflict.getMy());
    7373    }
     74
     75    @Override
     76    public int hashCode() {
     77        final int prime = 31;
     78        int result = super.hashCode();
     79        result = prime * result + ((conflict == null) ? 0 : conflict.hashCode());
     80        result = prime * result + ((mergedNodeList == null) ? 0 : mergedNodeList.hashCode());
     81        return result;
     82    }
     83
     84    @Override
     85    public boolean equals(Object obj) {
     86        if (this == obj)
     87            return true;
     88        if (!super.equals(obj))
     89            return false;
     90        if (getClass() != obj.getClass())
     91            return false;
     92        WayNodesConflictResolverCommand other = (WayNodesConflictResolverCommand) obj;
     93        if (conflict == null) {
     94            if (other.conflict != null)
     95                return false;
     96        } else if (!conflict.equals(other.conflict))
     97            return false;
     98        if (mergedNodeList == null) {
     99            if (other.mergedNodeList != null)
     100                return false;
     101        } else if (!mergedNodeList.equals(other.mergedNodeList))
     102            return false;
     103        return true;
     104    }
    74105}
Note: See TracChangeset for help on using the changeset viewer.