View Javadoc

1   /*
2    *                Doelan development code
3    *
4    * This code may be freely distributed and modified under the
5    * terms of the GNU General Public Licence.  This should
6    * be distributed with the code. If you do not have a copy,
7    * see:
8    *
9    *      http://www.gnu.org/copyleft/gpl.txt
10   *
11   * Copyright (c) 2004-2005 ENS Microarray Platform
12   * Copyright for this code is held jointly by the individual
13   * authors.  These should be listed in @author doc comments.
14   *
15   * For more information on the Doelan project and its aims,
16   * or to join the Doelan mailing list, visit the home page
17   * at:
18   *
19   *      http://www.transcriptome.ens.fr/doelan
20   */
21  
22  package fr.ens.transcriptome.doelan.data;
23  
24  import java.awt.Image;
25  import java.util.ArrayList;
26  import java.util.HashSet;
27  import java.util.Set;
28  
29  import fr.ens.transcriptome.doelan.Defaults;
30  import fr.ens.transcriptome.doelan.algorithms.QualityGlobalTest;
31  import fr.ens.transcriptome.nividic.om.BioAssay;
32  import fr.ens.transcriptome.nividic.platform.PlatformException;
33  import fr.ens.transcriptome.nividic.platform.workflow.Container;
34  import fr.ens.transcriptome.nividic.util.parameter.Parameters;
35  
36  /***
37   * This class contains the report information of a testsuite.
38   * @author Laurent Jourdren
39   */
40  public class TestSuiteResult {
41  
42    private String htmlReport;
43    private String chipTypeName;
44    private String testSuiteName;
45    private String description;
46    private Image arrayPlot;
47    private Set globalTest = new HashSet();
48    private BioAssay newArrayList;
49    private boolean result;
50    private ArrayList testIds = new ArrayList();
51    private String spotRejectedId = Defaults.REJECTED_SPOT_IDENTIFIER;
52    private String[] emptySpotIds;
53  
54    /***
55     * This class defines a object which contains a global test and its parameters
56     * @author Laurent Jourdren
57     */
58    public class GlobalTest {
59  
60      private QualityGlobalTest test;
61      private Parameters parameters;
62  
63      //
64      // Getters
65      //
66  
67      /***
68       * Get the parameters.
69       * @return Returns the parameters
70       */
71      public Parameters getParameters() {
72        return parameters;
73      }
74  
75      /***
76       * Get the test.
77       * @return Returns the test
78       */
79      public QualityGlobalTest getTest() {
80        return test;
81      }
82  
83      //
84      // Setters
85      //
86  
87      /***
88       * Set the parameters
89       * @param parameters The parameters to set
90       */
91      public void setParameters(final Parameters parameters) {
92        this.parameters = parameters;
93      }
94  
95      /***
96       * Set the test.
97       * @param test The test to set
98       */
99      public void setTest(final QualityGlobalTest test) {
100       this.test = test;
101     }
102 
103     //
104     // Other methods
105     //
106 
107     /***
108      * Excecute the test with its parameters
109      * @param container Container to put in the test
110      * @throws PlatformException if no test exists
111      */
112     public void executeTest(final Container container) throws PlatformException {
113       if (getTest() == null)
114         throw new PlatformException("No test to run");
115       getTest().doTest(container, getParameters());
116     }
117 
118     //
119     // Construtor
120     //
121 
122     /***
123      * Public constructor.
124      * @param test Test to set
125      * @param parameters Parameters to set
126      */
127     public GlobalTest(final QualityGlobalTest test, final Parameters parameters) {
128       setTest(test);
129       setParameters(parameters);
130 
131     }
132   }
133 
134   //
135   // Getters
136   //
137 
138   /***
139    * Get the name of the type of the chip.
140    * @return Returns the chipTypeName
141    */
142   public String getChipTypeName() {
143     return chipTypeName;
144   }
145 
146   /***
147    * Get the html report.
148    * @return Returns the htmlReport
149    */
150   public String getHtmlReport() {
151     return htmlReport;
152   }
153 
154   /***
155    * Get the test suite name.
156    * @return Returns the testSuiteName
157    */
158   public String getTestSuiteName() {
159     return testSuiteName;
160   }
161 
162   /***
163    * Get the arrayplot image.
164    * @return Returns the arrayPlot
165    */
166   public Image getArrayPlot() {
167     return arrayPlot;
168   }
169 
170   /***
171    * Get the new array list.
172    * @return Returns the newArrayList
173    */
174   public BioAssay getNewArrayList() {
175     return newArrayList;
176   }
177 
178   /***
179    * Set the new array list.
180    * @param newArrayList The newArrayList to set
181    */
182   public void setNewArrayList(final BioAssay newArrayList) {
183     this.newArrayList = newArrayList;
184   }
185 
186   /***
187    * Get the result of the test suite.
188    * @return Returns the result
189    */
190   public boolean getResult() {
191     return result;
192   }
193 
194   /***
195    * Get the identifier of teh rejected spots.
196    * @return the identifier of teh rejected spots
197    */
198   public String getSpotRejectedId() {
199     return spotRejectedId;
200   }
201 
202   /***
203    * Get the data description
204    * @return the description of the testsuite
205    */
206   public String getDescription() {
207     return description;
208   }
209 
210   /***
211    * Get the identifiers of the empty spots.
212    * @return The identifiers of the empty spots
213    */
214   public String[] getEmptySpotIds() {
215     return emptySpotIds;
216   }
217 
218   //
219   // Setters
220   //
221 
222   /***
223    * Set the identifiers of the empty spots.
224    * @param emptySpotIds The identifiers of the empty spots
225    */
226   public void setEmptySpotIds(final String[] emptySpotIds) {
227     this.emptySpotIds = emptySpotIds;
228   }
229 
230   /***
231    * Set the name of the type of the chip.
232    * @param chipTypeName The chipTypeName to set
233    */
234   public void setChipTypeName(final String chipTypeName) {
235     this.chipTypeName = chipTypeName;
236   }
237 
238   /***
239    * Set the code of the html report.
240    * @param htmlReport The htmlReport to set
241    */
242   public void setHtmlReport(final String htmlReport) {
243     this.htmlReport = htmlReport;
244   }
245 
246   /***
247    * Set the test suite name.
248    * @param testSuiteName The name of the testsuite
249    */
250   public void setTestSuiteName(final String testSuiteName) {
251     this.testSuiteName = testSuiteName;
252   }
253 
254   /***
255    * Set the arrayplot image.
256    * @param arrayPlot The arrayPlot to set
257    */
258   public void setArrayPlot(final Image arrayPlot) {
259     this.arrayPlot = arrayPlot;
260   }
261 
262   /***
263    * Set the result of the test suite.
264    * @param result The result to set
265    */
266   public void setResult(final boolean result) {
267     this.result = result;
268   }
269 
270   /***
271    * Set the identifier for the rejected spots.
272    * @param spotRejectedId The identifier of the rejected spots
273    */
274   public void setSpotRejectedId(final String spotRejectedId) {
275     this.spotRejectedId = spotRejectedId;
276   }
277 
278   /***
279    * Set the data description
280    * @param description Data description
281    */
282   public void setDescription(final String description) {
283     this.description = description;
284   }
285 
286   //
287   // Other methods
288   //
289 
290   /***
291    * Add a global test.
292    * @param test Test to add
293    * @param parameters Parameters of the global test
294    */
295   public void addGlobalTest(final QualityGlobalTest test,
296       final Parameters parameters) {
297 
298     GlobalTest gt = new GlobalTest(test, parameters);
299 
300     this.globalTest.add(gt);
301   }
302 
303   /***
304    * Add a global test.
305    * @param test Test to add
306    */
307   public void addGlobalTest(final GlobalTest test) {
308     this.globalTest.add(test);
309   }
310 
311   /***
312    * Get the global tests
313    * @return The global tests
314    */
315   public Set getGlobalTests() {
316     return this.globalTest;
317   }
318 
319   //
320   // Other methods
321   //
322 
323   /***
324    * Add a test id for the test order in the report.
325    * @param testId Test id to add
326    */
327   public void addTestId(final String testId) {
328     this.testIds.add(testId);
329   }
330 
331   /***
332    * Get the order of the tests.
333    * @return The order of the test
334    */
335   public String[] getTestIdsOrder() {
336 
337     String[] result = new String[this.testIds.size()];
338     this.testIds.toArray(result);
339 
340     return result;
341   }
342 
343   //
344   // Constructor
345   //
346   /***
347    * Public Constructor.
348    * @param chipTypeName The chipTypeName to set
349    * @param testSuiteName The name of the testsuite
350    * @param description Data description
351    */
352   public TestSuiteResult(final String chipTypeName, final String testSuiteName,
353       final String description) {
354     setChipTypeName(chipTypeName);
355     setTestSuiteName(testSuiteName);
356     setDescription(description);
357   }
358 
359 }