Source code: org/biomage/Array/Fiducial.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:06 AM *
43 * *
44 ***************************************************************************
45 */
46
47 /**
48 * org.biomage.Array
49 *
50 */
51 package org.biomage.Array;
52
53 /**
54 * Import list for Fiducial
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.HasDistanceUnit;
63 import org.biomage.Interface.HasFiducialType;
64 import org.biomage.Interface.HasPosition;
65 import org.biomage.Common.Describable;
66 import org.biomage.Description.OntologyEntry;
67 import org.biomage.DesignElement.Position;
68 import org.biomage.Measurement.DistanceUnit;
69
70 /**
71 * A marking on the surface of the array that can be used to identify
72 * the array's origin, the coordinates of which are the fiducial's
73 * centroid.
74 *
75 */
76 public
77 class Fiducial
78 extends Describable
79 implements Serializable,
80 HasDistanceUnit,
81 HasFiducialType,
82 HasPosition
83 {
84 /**
85 * The units the fiducial is measured in.
86 *
87 */
88 private DistanceUnit distanceUnit;
89
90
91 /**
92 * A descriptive string that indicates the type of a fiducial (e.g.
93 * the chrome border on an Affymetrix array, a laser ablation mark).
94 *
95 */
96 private OntologyEntry fiducialType;
97
98
99 /**
100 * The position, relative to the upper left corner, of the fiducial
101 *
102 */
103 private Position position;
104
105
106 /**
107 * Default constructor.
108 *
109 */
110 public
111 Fiducial()
112 {
113 super();
114 }
115
116 /**
117 * Attribute constructor.
118 *
119 * Looks up the attributes in the parameter and casts them from strings
120 * appropriately
121 * @param atts: the attribute list.
122 *
123 */
124 // TODO Work in progress (attribute constructor).
125 public
126 Fiducial(Attributes atts)
127 {
128 super(atts);
129
130 }
131
132 /**
133 * writeMAGEML
134 * <p>
135 * This method is responsible for assembling the attribute and
136 * association data into XML. It creates the object tag and then calls
137 * the writeAttributes and writeAssociation methods.
138 * <p>
139 *
140 */
141 public
142 void
143 writeMAGEML(Writer out)
144 throws IOException
145 {
146 out.write("<Fiducial");
147 writeAttributes(out);
148 out.write(">");
149 writeAssociations(out);
150 out.write("</Fiducial>");
151 }
152
153 /**
154 * writeAttributes
155 * <p>
156 * This method is responsible for assembling the attribute data into
157 * XML. It calls the super method to write out all attributes of this
158 * class and it's ancestors.
159 * <p>
160 *
161 */
162 public
163 void
164 writeAttributes(Writer out)
165 throws IOException
166 {
167 super.writeAttributes(out);
168 }
169
170 /**
171 * writeAssociations
172 * <p>
173 * This method is responsible for assembling the association data
174 * into XML. It calls the super method to write out all associations of
175 * this class's ancestors.
176 * <p>
177 *
178 */
179 public
180 void
181 writeAssociations(Writer out)
182 throws IOException
183 {
184 super.writeAssociations(out);
185 if ( fiducialType != null ){
186 out.write("<FiducialType_assn>");
187 fiducialType.writeMAGEML(out);
188 out.write("</FiducialType_assn>");
189 }
190 if ( distanceUnit != null ){
191 out.write("<DistanceUnit_assn>");
192 distanceUnit.writeMAGEML(out);
193 out.write("</DistanceUnit_assn>");
194 }
195 if ( position != null ){
196 out.write("<Position_assn>");
197 position.writeMAGEML(out);
198 out.write("</Position_assn>");
199 }
200 }
201
202 /**
203 * Set method for distanceUnit
204 * <p>
205 * @param value to set
206 * <p>
207 *
208 */
209 public
210 void
211 setDistanceUnit(
212 DistanceUnit distanceUnit
213 )
214 {
215 this.distanceUnit = distanceUnit;
216 }
217
218 /**
219 * Get method for distanceUnit
220 * <p>
221 * @return value of the attribute
222 * <p>
223 *
224 */
225 public
226 DistanceUnit
227 getDistanceUnit()
228 {
229 return distanceUnit;
230 }
231
232 /**
233 * Set method for fiducialType
234 * <p>
235 * @param value to set
236 * <p>
237 *
238 */
239 public
240 void
241 setFiducialType(
242 OntologyEntry fiducialType
243 )
244 {
245 this.fiducialType = fiducialType;
246 }
247
248 /**
249 * Get method for fiducialType
250 * <p>
251 * @return value of the attribute
252 * <p>
253 *
254 */
255 public
256 OntologyEntry
257 getFiducialType()
258 {
259 return fiducialType;
260 }
261
262 /**
263 * Set method for position
264 * <p>
265 * @param value to set
266 * <p>
267 *
268 */
269 public
270 void
271 setPosition(
272 Position position
273 )
274 {
275 this.position = position;
276 }
277
278 /**
279 * Get method for position
280 * <p>
281 * @return value of the attribute
282 * <p>
283 *
284 */
285 public
286 Position
287 getPosition()
288 {
289 return position;
290 }
291
292 }