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

Quick Search    Search Deep

Source code: org/biomage/Array/FeatureDefect.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:03 AM                                  *
43   *                                                                         *
44   ***************************************************************************
45   */
46  
47  /**
48   *  org.biomage.Array
49   *  
50   */
51  package org.biomage.Array;
52  
53  /**
54   *  Import list for FeatureDefect
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.HasPositionDelta;
63  import org.biomage.Interface.HasFeature;
64  import org.biomage.Interface.HasDefectType;
65  import org.biomage.Common.Extendable;
66  import org.biomage.Description.OntologyEntry;
67  import org.biomage.DesignElement.Feature;
68  
69  /**
70   *  Stores the defect information for a feature.
71   *  
72   */
73  public
74  class FeatureDefect
75      extends Extendable
76      implements Serializable,
77          HasPositionDelta,
78          HasFeature,
79          HasDefectType
80  {
81      /**
82       *  How the feature deviates in position from the ArrayDesign.
83       *  
84       */
85      private PositionDelta positionDelta;
86  
87  
88      /**
89       *  The feature that was manufactured defectively.
90       *  
91       */
92      private Feature feature;
93  
94  
95      /**
96       *  Indicates the type of defect (e.g. a missing feature or a moved 
97       *  feature).
98       *  
99       */
100     private OntologyEntry defectType;
101 
102 
103     /**
104      *  Default constructor.
105      *  
106      */
107     public
108     FeatureDefect()
109     {
110         super();
111     }
112 
113     /**
114      *  Attribute constructor.
115      *  
116      *  Looks up the attributes in the parameter and casts them from strings 
117      *  appropriately
118      *  @param atts: the attribute list.
119      *  
120      */
121     // TODO Work in progress (attribute constructor).
122     public
123     FeatureDefect(Attributes atts)
124     {
125         super(atts);
126 
127     }
128 
129     /**
130      *  writeMAGEML
131      *  <p>
132      *  This method is responsible for assembling the attribute and 
133      *  association data into XML. It creates the object tag and then calls 
134      *  the writeAttributes and writeAssociation methods.
135      *  <p>
136      *  
137      */
138     public
139     void
140     writeMAGEML(Writer out)
141     throws IOException
142     {
143         out.write("<FeatureDefect");
144         writeAttributes(out);
145         out.write(">");
146         writeAssociations(out);
147         out.write("</FeatureDefect>");
148     }
149 
150     /**
151      *  writeAttributes
152      *  <p>
153      *  This method is responsible for assembling the attribute data into 
154      *  XML. It calls the super method to write out all attributes of this 
155      *  class and it's ancestors.
156      *  <p>
157      *  
158      */
159     public
160     void
161     writeAttributes(Writer out)
162     throws IOException
163     {
164         super.writeAttributes(out);
165     }
166 
167     /**
168      *  writeAssociations
169      *  <p>
170      *  This method is responsible for assembling the association data 
171      *  into XML. It calls the super method to write out all associations of 
172      *  this class's ancestors.
173      *  <p>
174      *  
175      */
176     public
177     void
178     writeAssociations(Writer out)
179     throws IOException
180     {
181         super.writeAssociations(out);
182         if ( defectType != null ){
183             out.write("<DefectType_assn>");
184             defectType.writeMAGEML(out);
185             out.write("</DefectType_assn>");
186         }
187         if ( positionDelta != null ){
188             out.write("<PositionDelta_assn>");
189             positionDelta.writeMAGEML(out);
190             out.write("</PositionDelta_assn>");
191         }
192         if ( feature != null ){
193             out.write("<Feature_assnref>");
194             out.write("<Feature_ref identifier=\"" + feature.getIdentifier() + "\"/>");
195             out.write("</Feature_assnref>");
196         }
197     }
198 
199     /**
200      *  Set method for positionDelta
201      *  <p>
202      *  @param value to set
203      *  <p>
204      *  
205      */
206     public
207     void
208     setPositionDelta(
209         PositionDelta positionDelta
210     )
211     {
212         this.positionDelta = positionDelta;
213     }
214 
215     /**
216      *  Get method for positionDelta
217      *  <p>
218      *  @return value of the attribute
219      *  <p>
220      *  
221      */
222     public
223     PositionDelta
224     getPositionDelta()
225     {
226         return positionDelta;
227     }
228 
229     /**
230      *  Set method for feature
231      *  <p>
232      *  @param value to set
233      *  <p>
234      *  
235      */
236     public
237     void
238     setFeature(
239         Feature feature
240     )
241     {
242         this.feature = feature;
243     }
244 
245     /**
246      *  Get method for feature
247      *  <p>
248      *  @return value of the attribute
249      *  <p>
250      *  
251      */
252     public
253     Feature
254     getFeature()
255     {
256         return feature;
257     }
258 
259     /**
260      *  Set method for defectType
261      *  <p>
262      *  @param value to set
263      *  <p>
264      *  
265      */
266     public
267     void
268     setDefectType(
269         OntologyEntry defectType
270     )
271     {
272         this.defectType = defectType;
273     }
274 
275     /**
276      *  Get method for defectType
277      *  <p>
278      *  @return value of the attribute
279      *  <p>
280      *  
281      */
282     public
283     OntologyEntry
284     getDefectType()
285     {
286         return defectType;
287     }
288 
289 }