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

Quick Search    Search Deep

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