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

Quick Search    Search Deep

Source code: org/biomage/BioMaterial/BioMaterial.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:07 AM                                  *
43   *                                                                         *
44   ***************************************************************************
45   */
46  
47  /**
48   *  org.biomage.BioMaterial
49   *  
50   */
51  package org.biomage.BioMaterial;
52  
53  /**
54   *  Import list for BioMaterial
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.HasTreatments;
63  import org.biomage.Interface.HasMaterialType;
64  import org.biomage.Interface.HasCharacteristics;
65  import org.biomage.Interface.HasQualityControlStatistics;
66  import org.biomage.Common.Identifiable;
67  import org.biomage.Common.NameValueType;
68  import org.biomage.Description.OntologyEntry;
69  
70  /**
71   *  BioMaterial is an abstract class that represents the important 
72   *  substances such as cells, tissues, DNA, proteins, etc...  Biomaterials 
73   *  can be related to other biomaterial through a directed acyclic graph 
74   *  (represented by treatment(s)).
75   *  
76   */
77  public
78  abstract
79  class BioMaterial
80      extends Identifiable
81      implements Serializable,
82          HasTreatments,
83          HasMaterialType,
84          HasCharacteristics,
85          HasQualityControlStatistics
86  {
87      /**
88       *  This association is one way from BioMaterial to Treatment.  From 
89       *  this a BioMaterial can discover the amount and type of BioMaterial 
90       *  that was part of the treatment that produced it.
91       *  
92       */
93      private Treatments_list treatments = new Treatments_list();
94  
95      /**
96       *  The type of material used, i.e. rna, dna, lipid, phosphoprotein, 
97       *  etc.
98       *  
99       */
100     private OntologyEntry materialType;
101 
102 
103     /**
104      *  Innate properties of the biosource, such as genotype, cultivar, 
105      *  tissue type, cell type, ploidy, etc.
106      *  
107      */
108     private Characteristics_list characteristics = new Characteristics_list();
109 
110     /**
111      *  Measures of the quality of the BioMaterial.
112      *  
113      */
114     private QualityControlStatistics_list qualityControlStatistics = new QualityControlStatistics_list();
115 
116     /**
117      *  Default constructor.
118      *  
119      */
120     public
121     BioMaterial()
122     {
123         super();
124     }
125 
126     /**
127      *  Attribute constructor.
128      *  
129      *  Looks up the attributes in the parameter and casts them from strings 
130      *  appropriately
131      *  @param atts: the attribute list.
132      *  
133      */
134     // TODO Work in progress (attribute constructor).
135     public
136     BioMaterial(Attributes atts)
137     {
138         super(atts);
139 
140     }
141 
142     /**
143      *  writeMAGEML
144      *  <p>
145      *  This method is responsible for assembling the attribute and 
146      *  association data into XML. It creates the object tag and then calls 
147      *  the writeAttributes and writeAssociation methods.
148      *  <p>
149      *  
150      */
151     public
152     void
153     writeMAGEML(Writer out)
154     throws IOException
155     {
156     }
157 
158     /**
159      *  writeAttributes
160      *  <p>
161      *  This method is responsible for assembling the attribute data into 
162      *  XML. It calls the super method to write out all attributes of this 
163      *  class and it's ancestors.
164      *  <p>
165      *  
166      */
167     public
168     void
169     writeAttributes(Writer out)
170     throws IOException
171     {
172         super.writeAttributes(out);
173     }
174 
175     /**
176      *  writeAssociations
177      *  <p>
178      *  This method is responsible for assembling the association data 
179      *  into XML. It calls the super method to write out all associations of 
180      *  this class's ancestors.
181      *  <p>
182      *  
183      */
184     public
185     void
186     writeAssociations(Writer out)
187     throws IOException
188     {
189         super.writeAssociations(out);
190         if ( qualityControlStatistics.size() > 0 ){
191             out.write("<QualityControlStatistics_assnlist>");
192             for ( int i = 0; i < qualityControlStatistics.size(); i++) {
193                 ((NameValueType)qualityControlStatistics.elementAt(i)).writeMAGEML(out);
194             }
195             out.write("</QualityControlStatistics_assnlist>");
196         }
197         if ( characteristics.size() > 0 ){
198             out.write("<Characteristics_assnlist>");
199             for ( int i = 0; i < characteristics.size(); i++) {
200                 ((OntologyEntry)characteristics.elementAt(i)).writeMAGEML(out);
201             }
202             out.write("</Characteristics_assnlist>");
203         }
204         if ( materialType != null ){
205             out.write("<MaterialType_assn>");
206             materialType.writeMAGEML(out);
207             out.write("</MaterialType_assn>");
208         }
209         if ( treatments.size() > 0 ){
210             out.write("<Treatments_assnlist>");
211             for ( int i = 0; i < treatments.size(); i++) {
212                 ((Treatment)treatments.elementAt(i)).writeMAGEML(out);
213             }
214             out.write("</Treatments_assnlist>");
215         }
216     }
217 
218     /**
219      *  Set method for treatments
220      *  <p>
221      *  @param value to set
222      *  <p>
223      *  
224      */
225     public
226     void
227     setTreatments(
228         Treatments_list treatments
229     )
230     {
231         ((List)this.treatments).addAll((List)treatments);
232     }
233 
234     /**
235      *  Get method for treatments
236      *  <p>
237      *  @return value of the attribute
238      *  <p>
239      *  
240      */
241     public
242     Treatments_list
243     getTreatments()
244     {
245         return treatments;
246     }
247 
248     /**
249      *  Method to add Treatment to Treatments_list
250      *  
251      */
252     public
253     void
254     addToTreatments(
255         Treatment treatment
256     )
257     {
258         this.treatments.add(treatment);
259     }
260 
261     /**
262      *  Method to add Treatment at position to Treatments_list
263      *  
264      */
265     public
266     void
267     addToTreatments(
268         int position,
269         Treatment treatment
270     )
271     {
272         this.treatments.add(position, treatment);
273     }
274 
275     /**
276      *  Method to get Treatment from Treatments_list
277      *  
278      */
279     public
280     Treatment
281     getFromTreatments(
282         int position
283     )
284     {
285         return (Treatment) this.treatments.get(position);
286     }
287 
288     /**
289      *  Method to remove by position from Treatments_list
290      *  
291      */
292     public
293     void
294     removeElementAtFromTreatments(
295         int position
296     )
297     {
298         this.treatments.removeElementAt(position);
299     }
300 
301     /**
302      *  Method to remove first Treatment from Treatments_list
303      *  
304      */
305     public
306     void
307     removeFromTreatments(
308         Treatment treatment
309     )
310     {
311         this.treatments.remove(treatment);
312     }
313 
314     /**
315      *  Set method for materialType
316      *  <p>
317      *  @param value to set
318      *  <p>
319      *  
320      */
321     public
322     void
323     setMaterialType(
324         OntologyEntry materialType
325     )
326     {
327         this.materialType = materialType;
328     }
329 
330     /**
331      *  Get method for materialType
332      *  <p>
333      *  @return value of the attribute
334      *  <p>
335      *  
336      */
337     public
338     OntologyEntry
339     getMaterialType()
340     {
341         return materialType;
342     }
343 
344     /**
345      *  Set method for characteristics
346      *  <p>
347      *  @param value to set
348      *  <p>
349      *  
350      */
351     public
352     void
353     setCharacteristics(
354         Characteristics_list characteristics
355     )
356     {
357         ((List)this.characteristics).addAll((List)characteristics);
358     }
359 
360     /**
361      *  Get method for characteristics
362      *  <p>
363      *  @return value of the attribute
364      *  <p>
365      *  
366      */
367     public
368     Characteristics_list
369     getCharacteristics()
370     {
371         return characteristics;
372     }
373 
374     /**
375      *  Method to add OntologyEntry to Characteristics_list
376      *  
377      */
378     public
379     void
380     addToCharacteristics(
381         OntologyEntry ontologyEntry
382     )
383     {
384         this.characteristics.add(ontologyEntry);
385     }
386 
387     /**
388      *  Method to add OntologyEntry at position to Characteristics_list
389      *  
390      */
391     public
392     void
393     addToCharacteristics(
394         int position,
395         OntologyEntry ontologyEntry
396     )
397     {
398         this.characteristics.add(position, ontologyEntry);
399     }
400 
401     /**
402      *  Method to get OntologyEntry from Characteristics_list
403      *  
404      */
405     public
406     OntologyEntry
407     getFromCharacteristics(
408         int position
409     )
410     {
411         return (OntologyEntry) this.characteristics.get(position);
412     }
413 
414     /**
415      *  Method to remove by position from Characteristics_list
416      *  
417      */
418     public
419     void
420     removeElementAtFromCharacteristics(
421         int position
422     )
423     {
424         this.characteristics.removeElementAt(position);
425     }
426 
427     /**
428      *  Method to remove first OntologyEntry from Characteristics_list
429      *  
430      */
431     public
432     void
433     removeFromCharacteristics(
434         OntologyEntry ontologyEntry
435     )
436     {
437         this.characteristics.remove(ontologyEntry);
438     }
439 
440     /**
441      *  Set method for qualityControlStatistics
442      *  <p>
443      *  @param value to set
444      *  <p>
445      *  
446      */
447     public
448     void
449     setQualityControlStatistics(
450         QualityControlStatistics_list qualityControlStatistics
451     )
452     {
453         ((List)this.qualityControlStatistics).addAll((List)qualityControlStatistics);
454     }
455 
456     /**
457      *  Get method for qualityControlStatistics
458      *  <p>
459      *  @return value of the attribute
460      *  <p>
461      *  
462      */
463     public
464     QualityControlStatistics_list
465     getQualityControlStatistics()
466     {
467         return qualityControlStatistics;
468     }
469 
470     /**
471      *  Method to add NameValueType to QualityControlStatistics_list
472      *  
473      */
474     public
475     void
476     addToQualityControlStatistics(
477         NameValueType nameValueType
478     )
479     {
480         this.qualityControlStatistics.add(nameValueType);
481     }
482 
483     /**
484      *  Method to add NameValueType at position to 
485      *  QualityControlStatistics_list
486      *  
487      */
488     public
489     void
490     addToQualityControlStatistics(
491         int position,
492         NameValueType nameValueType
493     )
494     {
495         this.qualityControlStatistics.add(position, nameValueType);
496     }
497 
498     /**
499      *  Method to get NameValueType from QualityControlStatistics_list
500      *  
501      */
502     public
503     NameValueType
504     getFromQualityControlStatistics(
505         int position
506     )
507     {
508         return (NameValueType) this.qualityControlStatistics.get(position);
509     }
510 
511     /**
512      *  Method to remove by position from QualityControlStatistics_list
513      *  
514      */
515     public
516     void
517     removeElementAtFromQualityControlStatistics(
518         int position
519     )
520     {
521         this.qualityControlStatistics.removeElementAt(position);
522     }
523 
524     /**
525      *  Method to remove first NameValueType from 
526      *  QualityControlStatistics_list
527      *  
528      */
529     public
530     void
531     removeFromQualityControlStatistics(
532         NameValueType nameValueType
533     )
534     {
535         this.qualityControlStatistics.remove(nameValueType);
536     }
537 
538 }