From 1706deea223bc1a30d170596192d726b6847b7eb Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Fri, 15 Dec 2017 16:55:12 +0000 Subject: [PATCH] JAL-1953 equals and hashCode now takes node ID in account --- forester/java/src/org/forester/phylogeny/PhylogenyNode.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); } -- 1.7.10.2