From c6edbe626d40f7f02fb892da16620aef9d015f72 Mon Sep 17 00:00:00 2001 From: langella <langella@b8ef2a07-7df7-436f-90b9-41648038564b> Date: Sun, 29 May 2011 16:57:32 +0000 Subject: [PATCH] hashcode equality is double checked to avoid collision problems git-svn-id: https://subversion.renater.fr/xtandempipeline/trunk@112 b8ef2a07-7df7-436f-90b9-41648038564b --- xtandempipeline/debian/changelog | 1 + .../xtandempipeline/grouping/HashPeptide.java | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/xtandempipeline/debian/changelog b/xtandempipeline/debian/changelog index aeef40e07..81357770c 100644 --- a/xtandempipeline/debian/changelog +++ b/xtandempipeline/debian/changelog @@ -3,6 +3,7 @@ xtandempipeline (3.1.2-1) natty; urgency=low * Work In Progress * ODS export * Didier Chevret has found a bug (fixed in this version) : error writing MS sample name in project file + * HashCode collision problem on huge data file fixed for HashPeptide -- Olivier Langella <Olivier.Langella@moulon.inra.fr> Sun, 8 May 2011 9:18:51 +0200 diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashPeptide.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashPeptide.java index c906f26d3..60dc0535c 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashPeptide.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashPeptide.java @@ -19,12 +19,25 @@ public class HashPeptide extends HashKey4Groups { + sequence).hashCode(); } + @Override + public boolean equals(Object toCompare) { + if (this.hashCode() == toCompare.hashCode()) { + //very good idea Benoit ! + HashPeptide toComparePeptide = (HashPeptide) toCompare; + if ((this.hashSampleScan == toComparePeptide.hashSampleScan) + && (this.sequence == toComparePeptide.sequence)) { + return true; + } + } + return false; + } + @Override public String toString() { - return hashSampleScan.toString()+" "+sequence; - + return hashSampleScan.toString() + " " + sequence; + } - + @Override public int hashCode() { return this.hascode; -- GitLab