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

Quick Search    Search Deep

Source code: org/biomage/BioMaterial/BioSample.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 BioSample
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.HasType;
63  import org.biomage.Description.OntologyEntry;
64  
65  /**
66   *  BioSamples are products of treatments that are of interest.  
67   *  BioSamples are often used as the sources for other biosamples.  The Type 
68   *  attribute describes the role the BioSample holds in the treatment 
69   *  hierarchy.  This type can be an extract.
70   *  
71   */
72  public
73  class BioSample
74      extends BioMaterial
75      implements Serializable,
76          HasType
77  {
78      /**
79       *  The Type attribute describes the role the BioSample holds in the 
80       *  treatment hierarchy.  This type can be an extract.
81       *  
82       */
83      private OntologyEntry type;
84  
85  
86      /**
87       *  Default constructor.
88       *  
89       */
90      public
91      BioSample()
92      {
93          super();
94      }
95  
96      /**
97       *  Attribute constructor.
98       *  
99       *  Looks up the attributes in the parameter and casts them from strings 
100      *  appropriately
101      *  @param atts: the attribute list.
102      *  
103      */
104     // TODO Work in progress (attribute constructor).
105     public
106     BioSample(Attributes atts)
107     {
108         super(atts);
109 
110     }
111 
112     /**
113      *  writeMAGEML
114      *  <p>
115      *  This method is responsible for assembling the attribute and 
116      *  association data into XML. It creates the object tag and then calls 
117      *  the writeAttributes and writeAssociation methods.
118      *  <p>
119      *  
120      */
121     public
122     void
123     writeMAGEML(Writer out)
124     throws IOException
125     {
126         out.write("<BioSample");
127         writeAttributes(out);
128         out.write(">");
129         writeAssociations(out);
130         out.write("</BioSample>");
131     }
132 
133     /**
134      *  writeAttributes
135      *  <p>
136      *  This method is responsible for assembling the attribute data into 
137      *  XML. It calls the super method to write out all attributes of this 
138      *  class and it's ancestors.
139      *  <p>
140      *  
141      */
142     public
143     void
144     writeAttributes(Writer out)
145     throws IOException
146     {
147         super.writeAttributes(out);
148     }
149 
150     /**
151      *  writeAssociations
152      *  <p>
153      *  This method is responsible for assembling the association data 
154      *  into XML. It calls the super method to write out all associations of 
155      *  this class's ancestors.
156      *  <p>
157      *  
158      */
159     public
160     void
161     writeAssociations(Writer out)
162     throws IOException
163     {
164         super.writeAssociations(out);
165         if ( type != null ){
166             out.write("<Type_assn>");
167             type.writeMAGEML(out);
168             out.write("</Type_assn>");
169         }
170     }
171 
172     /**
173      *  Set method for type
174      *  <p>
175      *  @param value to set
176      *  <p>
177      *  
178      */
179     public
180     void
181     setType(
182         OntologyEntry type
183     )
184     {
185         this.type = type;
186     }
187 
188     /**
189      *  Get method for type
190      *  <p>
191      *  @return value of the attribute
192      *  <p>
193      *  
194      */
195     public
196     OntologyEntry
197     getType()
198     {
199         return type;
200     }
201 
202 }