Skip to content
Snippets Groups Projects
Commit 10bf5fc0 authored by langella's avatar langella
Browse files

big bug on grouping factories fixed

git-svn-id: https://subversion.renater.fr/xtandempipeline/trunk@294 b8ef2a07-7df7-436f-90b9-41648038564b
parent 8ae53d31
No related branches found
No related tags found
No related merge requests found
......@@ -15,16 +15,12 @@ public class HashPeptideSet extends HashKey4GroupsSet {
*/
private static final Logger logger = Logger.getLogger(HashPeptideSet.class);
private HashMap<Integer, HashPeptide> getHashPeptide = new HashMap<Integer, HashPeptide>(
0);
public HashPeptideSet() {
// logger.debug("HashPeptideSet begin");
}
@Override
public void clear() {
getHashPeptide = new HashMap<Integer, HashPeptide>(0);
super.clear();
}
......@@ -36,10 +32,20 @@ public class HashPeptideSet extends HashKey4GroupsSet {
HashPeptide temp = new HashPeptide(sampleScan, sequence);
if (this.add(temp)) {
getHashPeptide.put(temp.hashCode(), temp);
//this HashPeptide is new
return (temp);
}
return getHashPeptide.get(temp.hashCode());
else {
// find the existing instance of the same peptide scan :
for (HashKey4Groups toCompare:this) {
HashPeptide hashPeptideToCompare = (HashPeptide) toCompare;
if (temp.equals(hashPeptideToCompare)) {
return hashPeptideToCompare;
}
}
}
logger.error("ERROR this might not appear");
return temp;
}
}
package fr.inra.pappso.xtandempipeline.grouping;
import java.util.HashMap;
import org.apache.log4j.Logger;
public class HashProteinSet extends HashKey4GroupsSet {
......@@ -16,9 +14,6 @@ public class HashProteinSet extends HashKey4GroupsSet {
*/
private static final Logger logger = Logger.getLogger(HashProteinSet.class);
private HashMap<Integer, HashProtein> getHashProtein = new HashMap<Integer, HashProtein>(
0);
public HashProteinSet() {
// logger.debug("HashPeptideSet begin");
}
......@@ -27,15 +22,24 @@ public class HashProteinSet extends HashKey4GroupsSet {
HashProtein temp = new HashProtein(accession);
if (this.add(temp)) {
getHashProtein.put(temp.hashCode(), temp);
//this HashProtein is new
return (temp);
}
return getHashProtein.get(temp.hashCode());
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
public void clear() {
getHashProtein = new HashMap<Integer, HashProtein>(0);
super.clear();
}
......
......@@ -2,7 +2,6 @@ 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;
......@@ -18,9 +17,6 @@ public class HashSampleScanSet extends HashSet<HashSampleScan> implements
private static final Logger logger = Logger
.getLogger(HashSampleScanSet.class);
private HashMap<Integer, HashSampleScan> getSampleScan = new HashMap<Integer, HashSampleScan>(
0);
public HashSampleScanSet() {
}
......@@ -35,10 +31,19 @@ public class HashSampleScanSet extends HashSet<HashSampleScan> implements
HashSampleScan temp = new HashSampleScan(scan, msRun);
if (this.add(temp)) {
getSampleScan.put(temp.hashCode(), temp);
//this hashSampleScan is new
return (temp);
}
return getSampleScan.get(temp.hashCode());
else {
// find the existing instance of the same sample scan :
for (HashSampleScan toCompare:this) {
if (temp.equals(toCompare)) {
return toCompare;
}
}
}
logger.error("ERROR this might not appear");
return temp;
}
public void loggerDebug() {
......@@ -65,22 +70,7 @@ public class HashSampleScanSet extends HashSet<HashSampleScan> implements
@Override
public void clear() {
getSampleScan = new HashMap<Integer, HashSampleScan>(0);
super.clear();
}
// private String getFingerPrint() {
// ArrayList<String> strList = new ArrayList<String>(this.size());
// for (HashSampleScan sampleScan:this) {
// strList.add(sampleScan.getFingerPrint());
// }
// Collections.sort(strList);
// String code = new String();
// for (String sampleScanStr:strList) {
// code.concat(sampleScanStr);
// }
//
// return code;
// }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment