From 2a60631fc35cb237924541926f8693b1dbed373b Mon Sep 17 00:00:00 2001
From: langella <langella@b8ef2a07-7df7-436f-90b9-41648038564b>
Date: Sun, 10 Feb 2013 12:21:14 +0000
Subject: [PATCH] force instanciation of MsRun throught MsRunSet

git-svn-id: https://subversion.renater.fr/xtandempipeline/trunk@336 b8ef2a07-7df7-436f-90b9-41648038564b
---
 .../xtandempipeline/class_msms/MsRun.java     |  2 +-
 .../xtandempipeline/thread/individual.java    | 38 +++++++++++--------
 2 files changed, 24 insertions(+), 16 deletions(-)

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 5d8a456f6..89929923a 100644
--- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/MsRun.java
+++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/class_msms/MsRun.java
@@ -14,7 +14,7 @@ public class MsRun implements GrpMsSample {
 	private HashSet<IdentificationDataSource> files = new HashSet<IdentificationDataSource>(
 			0);
 
-	public MsRun(String sample_name) {
+	protected MsRun(String sample_name) {
 		logger.debug("MsRun begin "+sample_name);
 
 		sampleName = sample_name;
diff --git a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/individual.java b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/individual.java
index 485ddfcbf..a3ffa0477 100644
--- a/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/individual.java
+++ b/xtandempipeline/src/fr/inra/pappso/xtandempipeline/thread/individual.java
@@ -4,6 +4,7 @@ import java.util.ArrayList;
 import java.util.Vector;
 
 import fr.inra.pappso.xtandempipeline.XtandemPipelineSession;
+import fr.inra.pappso.xtandempipeline.MsException.MSMSException;
 import fr.inra.pappso.xtandempipeline.MsException.StopException;
 import fr.inra.pappso.xtandempipeline.class_msms.MsRun;
 import fr.inra.pappso.xtandempipeline.class_msms.MsRunSet;
@@ -37,29 +38,36 @@ public class individual extends process {
 		// Ecrire le process et penser à relever des StopException
 		for (int i = 0; i < dataSources.size(); i++) {
 			// parsing
-			this.set_view("Analysing file : " + (i + 1) + "/" + dataSources.size()
-					+ "\n" + "Parsing file : " + dataSources.get(i).getName());
-			
+			this.set_view("Analysing file : " + (i + 1) + "/"
+					+ dataSources.size() + "\n" + "Parsing file : "
+					+ dataSources.get(i).getName());
+
 			// Is sample exist? Get previous identification
 			Identification identtemp = null;
 			for (int m = 0; m < identifications.size(); m++) {
 				MsRunSet samples = identifications.get(m).get_samples();
-				MsRun test = new MsRun(dataSources.get(i).getName());
+				MsRun test = samples.getInstance(dataSources.get(i));
+				if (test == null) {
+					String message = "MsRun test is null";
+					logger.error(message);
+					throw new MSMSException(message);
+				}
 				if (samples.contains(test))
 					identtemp = identifications.get(m);
 			}
-			//xtandem handler;
-			//if (identtemp != null)
-			//	handler = new xtandem(identtemp, dataSources.get(i));
-			//else
-			//	handler = new xtandem(dataSources.get(i));
-			//new parse_file(handler, dataSources.get(i).);
+			// xtandem handler;
+			// if (identtemp != null)
+			// handler = new xtandem(identtemp, dataSources.get(i));
+			// else
+			// handler = new xtandem(dataSources.get(i));
+			// new parse_file(handler, dataSources.get(i).);
 			//
-			//if (identtemp == null)
-			//	identifications.add(handler.get_identifications());
-			
-			//Load identification from datasource
-			identifications.add(dataSources.get(i).loadIdentification(identtemp));
+			// if (identtemp == null)
+			// identifications.add(handler.get_identifications());
+
+			// Load identification from datasource
+			identifications.add(dataSources.get(i)
+					.loadIdentification(identtemp));
 
 			// verification pas arreté
 			if (this.isStop())
-- 
GitLab