Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/biomage/BioAssay/MeasuredBioAssay.java


1   /***************************************************************************  
2    *                                                                         *
3    * C O P Y R I G H T   N O T I C E                                         * 
4    *  Copyright (c) 2001 by:                                                 *
5    *    * The MicroArray Gene Expression Database group (MGED)               *
6    *    * Rosetta Inpharmatics                                               *
7    *                                                                         *
8    *    All Rights Reserved.                                                 *
9    *                                                                         *
10   * Permission is hereby granted, free of charge, to any person             *
11   * obtaining a copy of this software and associated documentation files    *
12   * (the "Software"), to deal in the Software without restriction,          *
13   * including without limitation the rights to use, copy, modify, merge,    *
14   * publish, distribute, sublicense, and/or sell copies of the Software,    *
15   * and to permit persons to whom the Software is furnished to do so,       *
16   * subject to the following conditions:                                    *
17   *                                                                         *
18   * The above copyright notice and this permission notice shall be          *
19   * included in all copies or substantial portions of the Software.         *
20   *                                                                         *
21   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,         *
22   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF      * 
23   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND                   *
24   * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS     *
25   * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN      *
26   * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN       *
27   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE        *
28   * SOFTWARE.                                                               *
29   ***************************************************************************
30   *                                                                         *
31   * Created by the create_mage_java_classes java program based on the       * 
32   * information in the xmi file created from the MAGE-OM UML model,         *
33   * copyright European Bioinformatics Institute (EBI) for MGED and Rosetta  *
34   * Informatics.                                                            *
35   *                                                                         *
36   * The ideas and work are built on the previous work in perl of Jason      *
37   * Stewart, Open Informatics, and Robert M. Hubley, Institute for Systems  *
38   * Biology                                                                 *
39   *                                                                         *
40   * @author  Michael Miller, Rosetta Inpharmatics                           *
41   * @version Revision: 1.0                                                  *
42   * @date    Thu, Feb 21, 2002 10:46:15 AM                                  *
43   *                                                                         *
44   ***************************************************************************
45   */
46  
47  /**
48   *  org.biomage.BioAssay
49   *  
50   */
51  package org.biomage.BioAssay;
52  
53  /**
54   *  Import list for MeasuredBioAssay
55   *  
56   */
57  import java.io.Serializable;
58  import java.util.*;
59  import org.xml.sax.Attributes;
60  import java.io.Writer;
61  import java.io.IOException;
62  import org.biomage.Interface.HasFeatureExtraction;
63  import org.biomage.Interface.HasMeasuredBioAssayData;
64  import org.biomage.BioAssayData.MeasuredBioAssayData;
65  
66  /**
67   *  A measured bioAssay is the direct processing of information in a 
68   *  physical bioAssay by the featureExtraction event.  Often uses images 
69   *  which are referenced through the physical bioAssay.
70   *  
71   */
72  public
73  class MeasuredBioAssay
74      extends BioAssay
75      implements Serializable,
76          HasFeatureExtraction,
77          HasMeasuredBioAssayData
78  {
79      /**
80       *  The association between the MeasuredBioAssay and the 
81       *  FeatureExtraction Event.
82       *  
83       */
84      private FeatureExtraction featureExtraction;
85  
86  
87      /**
88       *  The data associated with the MeasuredBioAssay.
89       *  
90       */
91      private MeasuredBioAssayData_list measuredBioAssayData = new MeasuredBioAssayData_list();
92  
93      /**
94       *  Default constructor.
95       *  
96       */
97      public
98      MeasuredBioAssay()
99      {
100         super();
101     }
102 
103     /**
104      *  Attribute constructor.
105      *  
106      *  Looks up the attributes in the parameter and casts them from strings 
107      *  appropriately
108      *  @param atts: the attribute list.
109      *  
110      */
111     // TODO Work in progress (attribute constructor).
112     public
113     MeasuredBioAssay(Attributes atts)
114     {
115         super(atts);
116 
117     }
118 
119     /**
120      *  writeMAGEML
121      *  <p>
122      *  This method is responsible for assembling the attribute and 
123      *  association data into XML. It creates the object tag and then calls 
124      *  the writeAttributes and writeAssociation methods.
125      *  <p>
126      *  
127      */
128     public
129     void
130     writeMAGEML(Writer out)
131     throws IOException
132     {
133         out.write("<MeasuredBioAssay");
134         writeAttributes(out);
135         out.write(">");
136         writeAssociations(out);
137         out.write("</MeasuredBioAssay>");
138     }
139 
140     /**
141      *  writeAttributes
142      *  <p>
143      *  This method is responsible for assembling the attribute data into 
144      *  XML. It calls the super method to write out all attributes of this 
145      *  class and it's ancestors.
146      *  <p>
147      *  
148      */
149     public
150     void
151     writeAttributes(Writer out)
152     throws IOException
153     {
154         super.writeAttributes(out);
155     }
156 
157     /**
158      *  writeAssociations
159      *  <p>
160      *  This method is responsible for assembling the association data 
161      *  into XML. It calls the super method to write out all associations of 
162      *  this class's ancestors.
163      *  <p>
164      *  
165      */
166     public
167     void
168     writeAssociations(Writer out)
169     throws IOException
170     {
171         super.writeAssociations(out);
172         if ( featureExtraction != null ){
173             out.write("<FeatureExtraction_assn>");
174             featureExtraction.writeMAGEML(out);
175             out.write("</FeatureExtraction_assn>");
176         }
177         if ( measuredBioAssayData.size() > 0 ){
178             out.write("<MeasuredBioAssayData_assnreflist>");
179             for ( int i = 0; i < measuredBioAssayData.size(); i++) {
180                 out.write("<MeasuredBioAssayData_ref identifier=\"" + ((MeasuredBioAssayData)measuredBioAssayData.elementAt(i)).getIdentifier() + "\"/>");
181             }
182             out.write("</MeasuredBioAssayData_assnreflist>");
183         }
184     }
185 
186     /**
187      *  Set method for featureExtraction
188      *  <p>
189      *  @param value to set
190      *  <p>
191      *  
192      */
193     public
194     void
195     setFeatureExtraction(
196         FeatureExtraction featureExtraction
197     )
198     {
199         this.featureExtraction = featureExtraction;
200     }
201 
202     /**
203      *  Get method for featureExtraction
204      *  <p>
205      *  @return value of the attribute
206      *  <p>
207      *  
208      */
209     public
210     FeatureExtraction
211     getFeatureExtraction()
212     {
213         return featureExtraction;
214     }
215 
216     /**
217      *  Set method for measuredBioAssayData
218      *  <p>
219      *  @param value to set
220      *  <p>
221      *  
222      */
223     public
224     void
225     setMeasuredBioAssayData(
226         MeasuredBioAssayData_list measuredBioAssayData
227     )
228     {
229         ((List)this.measuredBioAssayData).addAll((List)measuredBioAssayData);
230     }
231 
232     /**
233      *  Get method for measuredBioAssayData
234      *  <p>
235      *  @return value of the attribute
236      *  <p>
237      *  
238      */
239     public
240     MeasuredBioAssayData_list
241     getMeasuredBioAssayData()
242     {
243         return measuredBioAssayData;
244     }
245 
246     /**
247      *  Method to add MeasuredBioAssayData to MeasuredBioAssayData_list
248      *  
249      */
250     public
251     void
252     addToMeasuredBioAssayData(
253         MeasuredBioAssayData measuredBioAssayData
254     )
255     {
256         this.measuredBioAssayData.add(measuredBioAssayData);
257     }
258 
259     /**
260      *  Method to add MeasuredBioAssayData at position to 
261      *  MeasuredBioAssayData_list
262      *  
263      */
264     public
265     void
266     addToMeasuredBioAssayData(
267         int position,
268         MeasuredBioAssayData measuredBioAssayData
269     )
270     {
271         this.measuredBioAssayData.add(position, measuredBioAssayData);
272     }
273 
274     /**
275      *  Method to get MeasuredBioAssayData from MeasuredBioAssayData_list
276      *  
277      */
278     public
279     MeasuredBioAssayData
280     getFromMeasuredBioAssayData(
281         int position
282     )
283     {
284         return (MeasuredBioAssayData) this.measuredBioAssayData.get(position);
285     }
286 
287     /**
288      *  Method to remove by position from MeasuredBioAssayData_list
289      *  
290      */
291     public
292     void
293     removeElementAtFromMeasuredBioAssayData(
294         int position
295     )
296     {
297         this.measuredBioAssayData.removeElementAt(position);
298     }
299 
300     /**
301      *  Method to remove first MeasuredBioAssayData from 
302      *  MeasuredBioAssayData_list
303      *  
304      */
305     public
306     void
307     removeFromMeasuredBioAssayData(
308         MeasuredBioAssayData measuredBioAssayData
309     )
310     {
311         this.measuredBioAssayData.remove(measuredBioAssayData);
312     }
313 
314 }