Source code: org/biomage/BioMaterial/BioMaterial_package.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:57 AM *
43 * *
44 ***************************************************************************
45 */
46
47 /**
48 * org.biomage.BioMaterial
49 *
50 */
51 package org.biomage.BioMaterial;
52
53 /**
54 * Import list for BioMaterial_package
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
63 /**
64 * The classes in this package describe how a BioSource is treated to
65 * obtain the BioMaterial (typically a LabeledExtract) that is used by a
66 * BioAssayCreation in combination with an Array to produce a
67 * PhysicalBioAssay. A set of treatments are typically linear in time but
68 * can form a Directed Acyclic Graph.
69 *
70 */
71 public
72 class BioMaterial_package
73 implements Serializable
74 {
75 /**
76 * Inner list class for holding multiple entries for attribute
77 * bioSource_list. Simply creates a named vector.
78 *
79 */
80 public
81 class
82 BioSource_list extends Vector
83 {
84 }
85
86 /**
87 * The BioSource is the original source material before any
88 * treatment events. It is also a top node of the directed acyclic
89 * graph generated by treatments. The association to OntologyEntry
90 * allows enumeration of a BioSource's inherent properties.
91 *
92 */
93 public BioSource_list bioSource_list = new BioSource_list();
94
95 /**
96 * Inner list class for holding multiple entries for attribute
97 * bioMaterial_list. Simply creates a named vector.
98 *
99 */
100 public
101 class
102 BioMaterial_list extends Vector
103 {
104 }
105
106 /**
107 * BioMaterial is an abstract class that represents the important
108 * substances such as cells, tissues, DNA, proteins, etc...
109 * Biomaterials can be related to other biomaterial through a directed
110 * acyclic graph (represented by treatment(s)).
111 *
112 */
113 public BioMaterial_list bioMaterial_list = new BioMaterial_list();
114
115 /**
116 * Inner list class for holding multiple entries for attribute
117 * labeledExtract_list. Simply creates a named vector.
118 *
119 */
120 public
121 class
122 LabeledExtract_list extends Vector
123 {
124 }
125
126 /**
127 * LabeledExtracts are special BioSamples that have Compounds which
128 * are detectable (these are often fluorescent or reactive moieties).
129 *
130 */
131 public LabeledExtract_list labeledExtract_list = new LabeledExtract_list();
132
133 /**
134 * Inner list class for holding multiple entries for attribute
135 * bioSample_list. Simply creates a named vector.
136 *
137 */
138 public
139 class
140 BioSample_list extends Vector
141 {
142 }
143
144 /**
145 * BioSamples are products of treatments that are of interest.
146 * BioSamples are often used as the sources for other biosamples. The
147 * Type attribute describes the role the BioSample holds in the
148 * treatment hierarchy. This type can be an extract.
149 *
150 */
151 public BioSample_list bioSample_list = new BioSample_list();
152
153 /**
154 * Inner list class for holding multiple entries for attribute
155 * compound_list. Simply creates a named vector.
156 *
157 */
158 public
159 class
160 Compound_list extends Vector
161 {
162 }
163
164 /**
165 * A Compound can be a simple compound such as SDS (sodium dodecyl
166 * sulfate). It may also be made of other Compounds in proportions
167 * using CompoundMeasurements to enumerate the Compounds and their
168 * amounts such as LB (Luria Broth) Media.
169 *
170 */
171 public Compound_list compound_list = new Compound_list();
172
173 /**
174 * Default constructor.
175 *
176 */
177 public
178 BioMaterial_package()
179 {
180 }
181
182 /**
183 * Attribute constructor.
184 *
185 * Looks up the attributes in the parameter and casts them from strings
186 * appropriately
187 * @param atts: the attribute list.
188 *
189 */
190 // TODO Work in progress (attribute constructor).
191 public
192 BioMaterial_package(Attributes atts)
193 {
194 }
195
196 /**
197 * writeMAGEML
198 * <p>
199 * This method is responsible for assembling the attribute and
200 * association data into XML. It creates the object tag and then calls
201 * the writeAttributes and writeAssociation methods.
202 * <p>
203 *
204 */
205 public
206 void
207 writeMAGEML(Writer out)
208 throws IOException
209 {
210 out.write("<BioMaterial_package");
211 writeAttributes(out);
212 out.write(">");
213 writeAssociations(out);
214 out.write("</BioMaterial_package>");
215 }
216
217 /**
218 * writeAttributes
219 * <p>
220 * This method is responsible for assembling the attribute data into
221 * XML. It calls the super method to write out all attributes of this
222 * class and it's ancestors.
223 * <p>
224 *
225 */
226 public
227 void
228 writeAttributes(Writer out)
229 throws IOException
230 {
231 }
232
233 /**
234 * writeAssociations
235 * <p>
236 * This method is responsible for assembling the association data
237 * into XML. It calls the super method to write out all associations of
238 * this class's ancestors.
239 * <p>
240 *
241 */
242 public
243 void
244 writeAssociations(Writer out)
245 throws IOException
246 {
247 if ( compound_list.size() > 0 ){
248 out.write("<Compound_assnlist>");
249 for ( int i = 0; i < compound_list.size(); i++) {
250 ((Compound)compound_list.elementAt(i)).writeMAGEML(out);
251 }
252 out.write("</Compound_assnlist>");
253 }
254 if ( bioSample_list.size() > 0 ){
255 out.write("<BioSample_assnlist>");
256 for ( int i = 0; i < bioSample_list.size(); i++) {
257 ((BioSample)bioSample_list.elementAt(i)).writeMAGEML(out);
258 }
259 out.write("</BioSample_assnlist>");
260 }
261 if ( labeledExtract_list.size() > 0 ){
262 out.write("<LabeledExtract_assnlist>");
263 for ( int i = 0; i < labeledExtract_list.size(); i++) {
264 ((LabeledExtract)labeledExtract_list.elementAt(i)).writeMAGEML(out);
265 }
266 out.write("</LabeledExtract_assnlist>");
267 }
268 if ( bioMaterial_list.size() > 0 ){
269 out.write("<BioMaterial_assnlist>");
270 for ( int i = 0; i < bioMaterial_list.size(); i++) {
271 ((BioMaterial)bioMaterial_list.elementAt(i)).writeMAGEML(out);
272 }
273 out.write("</BioMaterial_assnlist>");
274 }
275 if ( bioSource_list.size() > 0 ){
276 out.write("<BioSource_assnlist>");
277 for ( int i = 0; i < bioSource_list.size(); i++) {
278 ((BioSource)bioSource_list.elementAt(i)).writeMAGEML(out);
279 }
280 out.write("</BioSource_assnlist>");
281 }
282 }
283
284 /**
285 * Set method for bioSource_list
286 * <p>
287 * @param value to set
288 * <p>
289 *
290 */
291 public
292 void
293 setBioSource_list(
294 BioSource_list bioSource_list
295 )
296 {
297 ((List)this.bioSource_list).addAll((List)bioSource_list);
298 }
299
300 /**
301 * Get method for bioSource_list
302 * <p>
303 * @return value of the attribute
304 * <p>
305 *
306 */
307 public
308 BioSource_list
309 getBioSource_list()
310 {
311 return bioSource_list;
312 }
313
314 /**
315 * Method to add BioSource to BioSource_list
316 *
317 */
318 public
319 void
320 addToBioSource_list(
321 BioSource bioSource
322 )
323 {
324 this.bioSource_list.add(bioSource);
325 }
326
327 /**
328 * Method to add BioSource at position to BioSource_list
329 *
330 */
331 public
332 void
333 addToBioSource_list(
334 int position,
335 BioSource bioSource
336 )
337 {
338 this.bioSource_list.add(position, bioSource);
339 }
340
341 /**
342 * Method to get BioSource from BioSource_list
343 *
344 */
345 public
346 BioSource
347 getFromBioSource_list(
348 int position
349 )
350 {
351 return (BioSource) this.bioSource_list.get(position);
352 }
353
354 /**
355 * Method to remove by position from BioSource_list
356 *
357 */
358 public
359 void
360 removeElementAtFromBioSource_list(
361 int position
362 )
363 {
364 this.bioSource_list.removeElementAt(position);
365 }
366
367 /**
368 * Method to remove first BioSource from BioSource_list
369 *
370 */
371 public
372 void
373 removeFromBioSource_list(
374 BioSource bioSource
375 )
376 {
377 this.bioSource_list.remove(bioSource);
378 }
379
380 /**
381 * Set method for bioMaterial_list
382 * <p>
383 * @param value to set
384 * <p>
385 *
386 */
387 public
388 void
389 setBioMaterial_list(
390 BioMaterial_list bioMaterial_list
391 )
392 {
393 ((List)this.bioMaterial_list).addAll((List)bioMaterial_list);
394 }
395
396 /**
397 * Get method for bioMaterial_list
398 * <p>
399 * @return value of the attribute
400 * <p>
401 *
402 */
403 public
404 BioMaterial_list
405 getBioMaterial_list()
406 {
407 return bioMaterial_list;
408 }
409
410 /**
411 * Method to add BioMaterial to BioMaterial_list
412 *
413 */
414 public
415 void
416 addToBioMaterial_list(
417 BioMaterial bioMaterial
418 )
419 {
420 this.bioMaterial_list.add(bioMaterial);
421 }
422
423 /**
424 * Method to add BioMaterial at position to BioMaterial_list
425 *
426 */
427 public
428 void
429 addToBioMaterial_list(
430 int position,
431 BioMaterial bioMaterial
432 )
433 {
434 this.bioMaterial_list.add(position, bioMaterial);
435 }
436
437 /**
438 * Method to get BioMaterial from BioMaterial_list
439 *
440 */
441 public
442 BioMaterial
443 getFromBioMaterial_list(
444 int position
445 )
446 {
447 return (BioMaterial) this.bioMaterial_list.get(position);
448 }
449
450 /**
451 * Method to remove by position from BioMaterial_list
452 *
453 */
454 public
455 void
456 removeElementAtFromBioMaterial_list(
457 int position
458 )
459 {
460 this.bioMaterial_list.removeElementAt(position);
461 }
462
463 /**
464 * Method to remove first BioMaterial from BioMaterial_list
465 *
466 */
467 public
468 void
469 removeFromBioMaterial_list(
470 BioMaterial bioMaterial
471 )
472 {
473 this.bioMaterial_list.remove(bioMaterial);
474 }
475
476 /**
477 * Set method for labeledExtract_list
478 * <p>
479 * @param value to set
480 * <p>
481 *
482 */
483 public
484 void
485 setLabeledExtract_list(
486 LabeledExtract_list labeledExtract_list
487 )
488 {
489 ((List)this.labeledExtract_list).addAll((List)labeledExtract_list);
490 }
491
492 /**
493 * Get method for labeledExtract_list
494 * <p>
495 * @return value of the attribute
496 * <p>
497 *
498 */
499 public
500 LabeledExtract_list
501 getLabeledExtract_list()
502 {
503 return labeledExtract_list;
504 }
505
506 /**
507 * Method to add LabeledExtract to LabeledExtract_list
508 *
509 */
510 public
511 void
512 addToLabeledExtract_list(
513 LabeledExtract labeledExtract
514 )
515 {
516 this.labeledExtract_list.add(labeledExtract);
517 }
518
519 /**
520 * Method to add LabeledExtract at position to LabeledExtract_list
521 *
522 */
523 public
524 void
525 addToLabeledExtract_list(
526 int position,
527 LabeledExtract labeledExtract
528 )
529 {
530 this.labeledExtract_list.add(position, labeledExtract);
531 }
532
533 /**
534 * Method to get LabeledExtract from LabeledExtract_list
535 *
536 */
537 public
538 LabeledExtract
539 getFromLabeledExtract_list(
540 int position
541 )
542 {
543 return (LabeledExtract) this.labeledExtract_list.get(position);
544 }
545
546 /**
547 * Method to remove by position from LabeledExtract_list
548 *
549 */
550 public
551 void
552 removeElementAtFromLabeledExtract_list(
553 int position
554 )
555 {
556 this.labeledExtract_list.removeElementAt(position);
557 }
558
559 /**
560 * Method to remove first LabeledExtract from LabeledExtract_list
561 *
562 */
563 public
564 void
565 removeFromLabeledExtract_list(
566 LabeledExtract labeledExtract
567 )
568 {
569 this.labeledExtract_list.remove(labeledExtract);
570 }
571
572 /**
573 * Set method for bioSample_list
574 * <p>
575 * @param value to set
576 * <p>
577 *
578 */
579 public
580 void
581 setBioSample_list(
582 BioSample_list bioSample_list
583 )
584 {
585 ((List)this.bioSample_list).addAll((List)bioSample_list);
586 }
587
588 /**
589 * Get method for bioSample_list
590 * <p>
591 * @return value of the attribute
592 * <p>
593 *
594 */
595 public
596 BioSample_list
597 getBioSample_list()
598 {
599 return bioSample_list;
600 }
601
602 /**
603 * Method to add BioSample to BioSample_list
604 *
605 */
606 public
607 void
608 addToBioSample_list(
609 BioSample bioSample
610 )
611 {
612 this.bioSample_list.add(bioSample);
613 }
614
615 /**
616 * Method to add BioSample at position to BioSample_list
617 *
618 */
619 public
620 void
621 addToBioSample_list(
622 int position,
623 BioSample bioSample
624 )
625 {
626 this.bioSample_list.add(position, bioSample);
627 }
628
629 /**
630 * Method to get BioSample from BioSample_list
631 *
632 */
633 public
634 BioSample
635 getFromBioSample_list(
636 int position
637 )
638 {
639 return (BioSample) this.bioSample_list.get(position);
640 }
641
642 /**
643 * Method to remove by position from BioSample_list
644 *
645 */
646 public
647 void
648 removeElementAtFromBioSample_list(
649 int position
650 )
651 {
652 this.bioSample_list.removeElementAt(position);
653 }
654
655 /**
656 * Method to remove first BioSample from BioSample_list
657 *
658 */
659 public
660 void
661 removeFromBioSample_list(
662 BioSample bioSample
663 )
664 {
665 this.bioSample_list.remove(bioSample);
666 }
667
668 /**
669 * Set method for compound_list
670 * <p>
671 * @param value to set
672 * <p>
673 *
674 */
675 public
676 void
677 setCompound_list(
678 Compound_list compound_list
679 )
680 {
681 ((List)this.compound_list).addAll((List)compound_list);
682 }
683
684 /**
685 * Get method for compound_list
686 * <p>
687 * @return value of the attribute
688 * <p>
689 *
690 */
691 public
692 Compound_list
693 getCompound_list()
694 {
695 return compound_list;
696 }
697
698 /**
699 * Method to add Compound to Compound_list
700 *
701 */
702 public
703 void
704 addToCompound_list(
705 Compound compound
706 )
707 {
708 this.compound_list.add(compound);
709 }
710
711 /**
712 * Method to add Compound at position to Compound_list
713 *
714 */
715 public
716 void
717 addToCompound_list(
718 int position,
719 Compound compound
720 )
721 {
722 this.compound_list.add(position, compound);
723 }
724
725 /**
726 * Method to get Compound from Compound_list
727 *
728 */
729 public
730 Compound
731 getFromCompound_list(
732 int position
733 )
734 {
735 return (Compound) this.compound_list.get(position);
736 }
737
738 /**
739 * Method to remove by position from Compound_list
740 *
741 */
742 public
743 void
744 removeElementAtFromCompound_list(
745 int position
746 )
747 {
748 this.compound_list.removeElementAt(position);
749 }
750
751 /**
752 * Method to remove first Compound from Compound_list
753 *
754 */
755 public
756 void
757 removeFromCompound_list(
758 Compound compound
759 )
760 {
761 this.compound_list.remove(compound);
762 }
763
764 }