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.algorithms;
23  
24  import fr.ens.transcriptome.doelan.data.DoelanDataUtils;
25  import fr.ens.transcriptome.doelan.data.QualityUnitTestResult;
26  import fr.ens.transcriptome.doelan.data.QualityUnitTestResultData;
27  import fr.ens.transcriptome.doelan.data.TestSuiteResult;
28  import fr.ens.transcriptome.nividic.om.BioAssay;
29  import fr.ens.transcriptome.nividic.platform.PlatformException;
30  import fr.ens.transcriptome.nividic.platform.workflow.Container;
31  import fr.ens.transcriptome.nividic.platform.workflow.SimpleAlgorithmEvent;
32  import fr.ens.transcriptome.nividic.util.parameter.Parameters;
33  
34  /***
35   * This class define a quality unit test.
36   * @author Laurent Jourdren
37   */
38  public abstract class QualityUnitTest extends QualityTest {
39  
40    protected void doIt(final Container c, final Parameters parameters)
41        throws PlatformException {
42  
43      BioAssay bioassay = DoelanDataUtils.getBioAssay(c);
44      BioAssay arraylist = DoelanDataUtils.getArrayList(c);
45      TestSuiteResult tsr = DoelanDataUtils.getTestSuiteResult(c);
46  
47      QualityUnitTestResult result = test(bioassay, arraylist, parameters);
48  
49      tsr.addTestId(result.getTestId());
50  
51      if (result == null)
52        throw new PlatformException("The result of " + getId() + " ("
53            + aboutModule().getName() + ") is null");
54  
55      c.add(new QualityUnitTestResultData(result));
56  
57      sendEvent(new SimpleAlgorithmEvent(this, RESULT_EVENT, result,
58          "result data"));
59    }
60  
61    /***
62     * Test if the test is deletable().
63     * @return true if the test is deletable
64     */
65    public boolean isDeletable() {
66      return true;
67    }
68  
69    /***
70     * Test if only one instance of the test could be created.
71     * @return true if only one instance of the test could be created
72     */
73    public boolean isUniqueInstance() {
74      return false;
75    }
76  
77    /***
78     * Test if the test is modifiable.
79     * @return true if the test is modifiable
80     */
81    public boolean isModifiable() {
82      return true;
83    }
84  
85    /***
86     * Test if the test could be showed.
87     * @return true if the test could be showed
88     */
89    public boolean isShowable() {
90      return true;
91    }
92  
93    /***
94     * Test if the test could be diplayed in the list of tests to add.
95     * @return true if the test could be showed
96     */
97    public boolean isAddable() {
98      return true;
99    }
100 
101   //
102   // Abstract methods
103   //
104 
105   /***
106    * Test the quality of the bioassay.
107    * @param bioassay BioAssay to test
108    * @param parameters Parameters of the test
109    * @param arrayList The array list
110    * @return A QualityObjectResultTest Object
111    * @throws PlatformException if an error occurs while executing the test.
112    */
113   protected abstract QualityUnitTestResult test(final BioAssay bioassay,
114       final BioAssay arrayList, final Parameters parameters)
115       throws PlatformException;
116 
117   //
118   // Constructor
119   //
120 
121   /***
122    * Public constructor.
123    * @throws PlatformException If the name or the version of the element is
124    *                 <b>null </b>.
125    */
126   public QualityUnitTest() throws PlatformException {
127     // MUST BE EMPTY
128   }
129 }