diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/MsRun.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/MsRun.java index 86dae80c524e26ad4cc6b35e040536c992d563e7..bf927ea3a675867696994b8b2473bd6a6045454e 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/MsRun.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/MsRun.java @@ -6,11 +6,12 @@ import org.apache.log4j.Logger; import fr.inra.pappso.xtandempipeline.class_msms.IdentificationDataFile.IdentificationDataSource; -public class MsRun implements Comparable<MsRun>{ +public class MsRun implements Comparable<MsRun> { private static final Logger logger = Logger.getLogger(MsRun.class); private String sample; - private HashSet<IdentificationDataSource> files = new HashSet<IdentificationDataSource>(0); + private HashSet<IdentificationDataSource> files = new HashSet<IdentificationDataSource>( + 0); public MsRun(String sample_name) { logger.debug("MsRun begin"); @@ -18,10 +19,10 @@ public class MsRun implements Comparable<MsRun>{ } public IdentificationDataSource addFile(IdentificationDataSource file) { - if(files.add(file)) { + if (files.add(file)) { return file; } - for (IdentificationDataSource otherFile:this.files) { + for (IdentificationDataSource otherFile : this.files) { if (file.equals(otherFile)) { return otherFile; } @@ -32,16 +33,25 @@ public class MsRun implements Comparable<MsRun>{ public String getSampleName() { return sample; } - + @Override public int hashCode() { return sample.hashCode(); } - + @Override public boolean equals(Object toCompare) { if (this.hashCode() == toCompare.hashCode()) { - return true; + MsRun msRunCompare = (MsRun) toCompare; + if (this.sample.equals(msRunCompare.sample)) { + return true; + } + + else { + logger.debug("msRun COLLISION on " + sample + " compared to " + + msRunCompare.sample); + + } } return false; } @@ -49,5 +59,5 @@ public class MsRun implements Comparable<MsRun>{ public int compareTo(MsRun arg0) { return this.sample.compareTo(arg0.sample); } - + }