From: kjvdheide Date: Fri, 15 Dec 2017 16:55:12 +0000 (+0000) Subject: JAL-1953 equals and hashCode now takes node ID in account X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1706deea223bc1a30d170596192d726b6847b7eb;p=jalview.git JAL-1953 equals and hashCode now takes node ID in account --- diff --git a/forester/java/src/org/forester/phylogeny/PhylogenyNode.java b/forester/java/src/org/forester/phylogeny/PhylogenyNode.java index 25b33d7..15b3070 100644 --- a/forester/java/src/org/forester/phylogeny/PhylogenyNode.java +++ b/forester/java/src/org/forester/phylogeny/PhylogenyNode.java @@ -225,6 +225,9 @@ public final class PhylogenyNode implements Comparable { if ( !getName().equals( other.getName() ) ) { return false; } + if (getId() != other.getId()) { + return false; + } final NodeData this_data = getNodeData(); final NodeData other_data = other.getNodeData(); if ( ( this_data.isHasSequence() && other_data.isHasSequence() ) @@ -602,7 +605,7 @@ public final class PhylogenyNode implements Comparable { if ( ( getName().length() < 1 ) && !data.isHasSequence() && !data.isHasTaxonomy() ) { return super.hashCode(); } - int result = getName().hashCode(); + int result = getName().hashCode() * (int) getId(); if ( data.isHasSequence() ) { result ^= data.getSequence().hashCode(); }