Skip to content
Snippets Groups Projects
Commit 4920b93a authored by langella's avatar langella
Browse files

clear function overrided on sets

git-svn-id: https://subversion.renater.fr/xtandempipeline/trunk@72 b8ef2a07-7df7-436f-90b9-41648038564b
parent 548e3b52
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,11 @@ public class Match implements Comparable<Match> {
this.protein_match = new Protein();
this.isvalidate = true;
}
@Override
protected void finalize() throws Throwable {
logger.debug("finalize Match");
}
public void add_peptide_match(Peptide P) {
// if (!this.peptides_match.containsKey(P.get_sample_scan_cle()))
......
......@@ -2,6 +2,7 @@ package fr.inra.pappso.xtandempipeline.grouping;
import java.util.HashMap;
import java.util.HashSet;
import java.util.TreeSet;
import org.apache.log4j.Logger;
......@@ -20,10 +21,17 @@ public class HashPeptideSet extends HashKey4GroupsSet {
0);
public HashPeptideSet() {
//logger.debug("HashPeptideSet begin");
// logger.debug("HashPeptideSet begin");
}
public HashPeptide getInstance(HashSampleScan sampleScan, String sequence) throws Exception {
@Override
public void clear() {
getHashPeptide = new HashMap<Integer, HashPeptide>(0);
super.clear();
}
public HashPeptide getInstance(HashSampleScan sampleScan, String sequence)
throws Exception {
if (sampleScan == null) {
throw new Exception("sampleScan is null");
}
......
......@@ -20,7 +20,7 @@ public class HashProteinSet extends HashKey4GroupsSet {
0);
public HashProteinSet() {
//logger.debug("HashPeptideSet begin");
// logger.debug("HashPeptideSet begin");
}
public HashProtein getInstance(String accession) {
......@@ -33,4 +33,10 @@ public class HashProteinSet extends HashKey4GroupsSet {
return getHashProtein.get(temp.hashCode());
}
@Override
public void clear() {
getHashProtein = new HashMap<Integer, HashProtein>(0);
super.clear();
}
}
package fr.inra.pappso.xtandempipeline.grouping;
import org.apache.log4j.Logger;
import fr.inra.pappso.xtandempipeline.class_msms.MsRun;
public class HashSampleScan implements Comparable<HashSampleScan> {
private static final Logger logger = Logger.getLogger(HashSampleScan.class);
private int scan;
private MsRun msRun;
private int hascode;
......@@ -14,6 +18,11 @@ public class HashSampleScan implements Comparable<HashSampleScan> {
this.msRun = msRun;
this.hascode = this.getHashCodeStr().hashCode();
}
@Override
protected void finalize() throws Throwable {
logger.debug("finalize HashSampleScan");
}
private String getHashCodeStr() {
String code;
......
......@@ -28,7 +28,7 @@ public class HashSampleScanSet extends HashSet<HashSampleScan> implements
int i = arg0.size() - this.size();
if (i != 0)
return i;
return (this.getFingerCode()-arg0.getFingerCode());
return (this.getFingerCode() - arg0.getFingerCode());
}
public HashSampleScan getInstance(int scan, MsRun msRun) {
......@@ -48,34 +48,39 @@ public class HashSampleScanSet extends HashSet<HashSampleScan> implements
}
// return null;
}
public ArrayList<HashSampleScan> getHashSampleScanList(){
public ArrayList<HashSampleScan> getHashSampleScanList() {
ArrayList<HashSampleScan> array = new ArrayList<HashSampleScan>(this);
Collections.sort(array);
return(array);
return (array);
}
private int getFingerCode() {
int finger = 0;
for (HashSampleScan sampleScan:this) {
finger+=sampleScan.getScan();
for (HashSampleScan sampleScan : this) {
finger += sampleScan.getScan();
}
return(finger);
return (finger);
}
@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;
// }
// 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;
// }
}
......@@ -43,6 +43,13 @@ public class HashSampleScanSetPhospho extends HashSampleScanSetProt {
}
@Override
public void clear() {
phosphoPositions = new TreeSet<Integer>();
super.clear();
}
@Override
public int compareTo(HashSampleScanSet o) {
int i = o.size() - this.size();
......
package fr.inra.pappso.xtandempipeline.grouping;
import java.util.HashMap;
import java.util.HashSet;
import org.apache.log4j.Logger;
......@@ -34,6 +35,12 @@ public class HashSampleScanSetProt extends HashSampleScanSet {
}
}
@Override
public void clear() {
match = null;
super.clear();
}
@Override
public String toString() {
return match.get_protein_match().get_cle_accession();
......
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