Source code: org/biomage/BioAssay/BioAssayTreatment.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:16 AM *
43 * *
44 ***************************************************************************
45 */
46
47 /**
48 * org.biomage.BioAssay
49 *
50 */
51 package org.biomage.BioAssay;
52
53 /**
54 * Import list for BioAssayTreatment
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.HasPhysicalBioAssay;
63 import org.biomage.Interface.HasTarget;
64 import org.biomage.BioEvent.BioEvent;
65
66 /**
67 * The event which records the process by which PhysicalBioAssays are
68 * processed (typically washing, blocking, etc...).
69 *
70 */
71 public
72 class BioAssayTreatment
73 extends BioEvent
74 implements Serializable,
75 HasPhysicalBioAssay,
76 HasTarget
77 {
78 /**
79 * The set of treatments undergone by this PhysicalBioAssay.
80 *
81 */
82 private PhysicalBioAssay physicalBioAssay;
83
84
85 /**
86 * The PhysicalBioAssay that was treated.
87 *
88 */
89 private PhysicalBioAssay target;
90
91
92 /**
93 * Default constructor.
94 *
95 */
96 public
97 BioAssayTreatment()
98 {
99 super();
100 }
101
102 /**
103 * Attribute constructor.
104 *
105 * Looks up the attributes in the parameter and casts them from strings
106 * appropriately
107 * @param atts: the attribute list.
108 *
109 */
110 // TODO Work in progress (attribute constructor).
111 public
112 BioAssayTreatment(Attributes atts)
113 {
114 super(atts);
115
116 }
117
118 /**
119 * writeMAGEML
120 * <p>
121 * This method is responsible for assembling the attribute and
122 * association data into XML. It creates the object tag and then calls
123 * the writeAttributes and writeAssociation methods.
124 * <p>
125 *
126 */
127 public
128 void
129 writeMAGEML(Writer out)
130 throws IOException
131 {
132 out.write("<BioAssayTreatment");
133 writeAttributes(out);
134 out.write(">");
135 writeAssociations(out);
136 out.write("</BioAssayTreatment>");
137 }
138
139 /**
140 * writeAttributes
141 * <p>
142 * This method is responsible for assembling the attribute data into
143 * XML. It calls the super method to write out all attributes of this
144 * class and it's ancestors.
145 * <p>
146 *
147 */
148 public
149 void
150 writeAttributes(Writer out)
151 throws IOException
152 {
153 super.writeAttributes(out);
154 }
155
156 /**
157 * writeAssociations
158 * <p>
159 * This method is responsible for assembling the association data
160 * into XML. It calls the super method to write out all associations of
161 * this class's ancestors.
162 * <p>
163 *
164 */
165 public
166 void
167 writeAssociations(Writer out)
168 throws IOException
169 {
170 super.writeAssociations(out);
171 if ( physicalBioAssay != null ){
172 out.write("<PhysicalBioAssay_assnref>");
173 out.write("<PhysicalBioAssay_ref identifier=\"" + physicalBioAssay.getIdentifier() + "\"/>");
174 out.write("</PhysicalBioAssay_assnref>");
175 }
176 if ( target != null ){
177 out.write("<Target_assnref>");
178 out.write("<PhysicalBioAssay_ref identifier=\"" + target.getIdentifier() + "\"/>");
179 out.write("</Target_assnref>");
180 }
181 }
182
183 /**
184 * Set method for physicalBioAssay
185 * <p>
186 * @param value to set
187 * <p>
188 *
189 */
190 public
191 void
192 setPhysicalBioAssay(
193 PhysicalBioAssay physicalBioAssay
194 )
195 {
196 this.physicalBioAssay = physicalBioAssay;
197 }
198
199 /**
200 * Get method for physicalBioAssay
201 * <p>
202 * @return value of the attribute
203 * <p>
204 *
205 */
206 public
207 PhysicalBioAssay
208 getPhysicalBioAssay()
209 {
210 return physicalBioAssay;
211 }
212
213 /**
214 * Set method for target
215 * <p>
216 * @param value to set
217 * <p>
218 *
219 */
220 public
221 void
222 setTarget(
223 PhysicalBioAssay target
224 )
225 {
226 this.target = target;
227 }
228
229 /**
230 * Get method for target
231 * <p>
232 * @return value of the attribute
233 * <p>
234 *
235 */
236 public
237 PhysicalBioAssay
238 getTarget()
239 {
240 return target;
241 }
242
243 }