diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashPeptideSet.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashPeptideSet.java index cea6378af98534fe378b197c61667d281ec41912..adede18de9f7f9d592f15e610864a78fffbdf0c0 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashPeptideSet.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashPeptideSet.java @@ -15,6 +15,9 @@ public class HashPeptideSet extends HashKey4GroupsSet { */ private static final Logger logger = Logger.getLogger(HashPeptideSet.class); + private HashMap<HashPeptide, HashPeptide> mapHashPeptide = new HashMap<HashPeptide, HashPeptide>( + 0); + public HashPeptideSet() { // logger.debug("HashPeptideSet begin"); } @@ -32,20 +35,13 @@ public class HashPeptideSet extends HashKey4GroupsSet { HashPeptide temp = new HashPeptide(sampleScan, sequence); if (this.add(temp)) { - //this HashPeptide is new + // this HashPeptide is new + this.mapHashPeptide.put(temp, temp); return (temp); - } - else { + } else { // find the existing instance of the same peptide scan : - for (HashKey4Groups toCompare:this) { - HashPeptide hashPeptideToCompare = (HashPeptide) toCompare; - if (temp.equals(hashPeptideToCompare)) { - return hashPeptideToCompare; - } - } + return this.mapHashPeptide.get(temp); } - logger.error("ERROR this might not appear"); - return temp; } } diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashProteinSet.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashProteinSet.java index dabf87b0772f367afb6937f6e378f59269bb3faf..182d2e77b6b1bfb1f459d46bb82f1bf259399471 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashProteinSet.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashProteinSet.java @@ -1,5 +1,7 @@ package fr.inra.pappso.xtandempipeline.grouping; +import java.util.HashMap; + import org.apache.log4j.Logger; public class HashProteinSet extends HashKey4GroupsSet { @@ -14,28 +16,23 @@ public class HashProteinSet extends HashKey4GroupsSet { */ private static final Logger logger = Logger.getLogger(HashProteinSet.class); + private HashMap<HashProtein, HashProtein> mapHashProtein = new HashMap<HashProtein, HashProtein>( + 0); + public HashProteinSet() { // logger.debug("HashPeptideSet begin"); } public HashProtein getInstance(String accession) { HashProtein temp = new HashProtein(accession); - if (this.add(temp)) { - //this HashProtein is new + // this HashProtein is new + this.mapHashProtein.put(temp, temp); return (temp); + } else { + // find the existing instance of the same protein : + return this.mapHashProtein.get(temp); } - else { - // find the existing instance of the same sample scan : - for (HashKey4Groups toCompare:this) { - HashProtein hashProtToCompare = (HashProtein) toCompare; - if (temp.equals(hashProtToCompare)) { - return hashProtToCompare; - } - } - } - logger.error("ERROR this might not appear"); - return temp; } @Override diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashSampleScanSet.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashSampleScanSet.java index a7abc976968bedbff1a9fcc408d76de4f6dff76a..76bd0bb868c2d777d9ecaec132f4df227e4b78d7 100644 --- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashSampleScanSet.java +++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/grouping/HashSampleScanSet.java @@ -2,6 +2,7 @@ package fr.inra.pappso.xtandempipeline.grouping; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import org.apache.log4j.Logger; @@ -16,6 +17,8 @@ public class HashSampleScanSet extends HashSet<HashSampleScan> implements private static final long serialVersionUID = -9055338154900110371L; private static final Logger logger = Logger .getLogger(HashSampleScanSet.class); + private HashMap<HashSampleScan, HashSampleScan> mapHashSampleScan = new HashMap<HashSampleScan, HashSampleScan>( + 0); public HashSampleScanSet() { } @@ -31,19 +34,13 @@ public class HashSampleScanSet extends HashSet<HashSampleScan> implements HashSampleScan temp = new HashSampleScan(scan, msRun); if (this.add(temp)) { - //this hashSampleScan is new + // this HashSampleScan is new + this.mapHashSampleScan.put(temp, temp); return (temp); - } - else { + } else { // find the existing instance of the same sample scan : - for (HashSampleScan toCompare:this) { - if (temp.equals(toCompare)) { - return toCompare; - } - } + return this.mapHashSampleScan.get(temp); } - logger.error("ERROR this might not appear"); - return temp; } public void loggerDebug() {