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

Quick Search    Search Deep

Source code: org/biomage/BioAssayData/DesignElementMapping.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:20 AM                                  *
43   *                                                                         *
44   ***************************************************************************
45   */
46  
47  /**
48   *  org.biomage.BioAssayData
49   *  
50   */
51  package org.biomage.BioAssayData;
52  
53  /**
54   *  Import list for DesignElementMapping
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.HasDesignElementMaps;
63  import org.biomage.Common.Extendable;
64  
65  /**
66   *  Container of the mappings of the input DesignElement dimensions to 
67   *  the output DesignElement dimension.
68   *  
69   */
70  public
71  class DesignElementMapping
72      extends Extendable
73      implements Serializable,
74          HasDesignElementMaps
75  {
76      /**
77       *  The maps for the DesignElements.
78       *  
79       */
80      private DesignElementMaps_list designElementMaps = new DesignElementMaps_list();
81  
82      /**
83       *  Default constructor.
84       *  
85       */
86      public
87      DesignElementMapping()
88      {
89          super();
90      }
91  
92      /**
93       *  Attribute constructor.
94       *  
95       *  Looks up the attributes in the parameter and casts them from strings 
96       *  appropriately
97       *  @param atts: the attribute list.
98       *  
99       */
100     // TODO Work in progress (attribute constructor).
101     public
102     DesignElementMapping(Attributes atts)
103     {
104         super(atts);
105 
106     }
107 
108     /**
109      *  writeMAGEML
110      *  <p>
111      *  This method is responsible for assembling the attribute and 
112      *  association data into XML. It creates the object tag and then calls 
113      *  the writeAttributes and writeAssociation methods.
114      *  <p>
115      *  
116      */
117     public
118     void
119     writeMAGEML(Writer out)
120     throws IOException
121     {
122         out.write("<DesignElementMapping");
123         writeAttributes(out);
124         out.write(">");
125         writeAssociations(out);
126         out.write("</DesignElementMapping>");
127     }
128 
129     /**
130      *  writeAttributes
131      *  <p>
132      *  This method is responsible for assembling the attribute data into 
133      *  XML. It calls the super method to write out all attributes of this 
134      *  class and it's ancestors.
135      *  <p>
136      *  
137      */
138     public
139     void
140     writeAttributes(Writer out)
141     throws IOException
142     {
143         super.writeAttributes(out);
144     }
145 
146     /**
147      *  writeAssociations
148      *  <p>
149      *  This method is responsible for assembling the association data 
150      *  into XML. It calls the super method to write out all associations of 
151      *  this class's ancestors.
152      *  <p>
153      *  
154      */
155     public
156     void
157     writeAssociations(Writer out)
158     throws IOException
159     {
160         super.writeAssociations(out);
161         if ( designElementMaps.size() > 0 ){
162             out.write("<DesignElementMaps_assnreflist>");
163             for ( int i = 0; i < designElementMaps.size(); i++) {
164                 out.write("<DesignElementMap_ref identifier=\"" + ((DesignElementMap)designElementMaps.elementAt(i)).getIdentifier() + "\"/>");
165             }
166             out.write("</DesignElementMaps_assnreflist>");
167         }
168     }
169 
170     /**
171      *  Set method for designElementMaps
172      *  <p>
173      *  @param value to set
174      *  <p>
175      *  
176      */
177     public
178     void
179     setDesignElementMaps(
180         DesignElementMaps_list designElementMaps
181     )
182     {
183         ((List)this.designElementMaps).addAll((List)designElementMaps);
184     }
185 
186     /**
187      *  Get method for designElementMaps
188      *  <p>
189      *  @return value of the attribute
190      *  <p>
191      *  
192      */
193     public
194     DesignElementMaps_list
195     getDesignElementMaps()
196     {
197         return designElementMaps;
198     }
199 
200     /**
201      *  Method to add DesignElementMap to DesignElementMaps_list
202      *  
203      */
204     public
205     void
206     addToDesignElementMaps(
207         DesignElementMap designElementMap
208     )
209     {
210         this.designElementMaps.add(designElementMap);
211     }
212 
213     /**
214      *  Method to add DesignElementMap at position to 
215      *  DesignElementMaps_list
216      *  
217      */
218     public
219     void
220     addToDesignElementMaps(
221         int position,
222         DesignElementMap designElementMap
223     )
224     {
225         this.designElementMaps.add(position, designElementMap);
226     }
227 
228     /**
229      *  Method to get DesignElementMap from DesignElementMaps_list
230      *  
231      */
232     public
233     DesignElementMap
234     getFromDesignElementMaps(
235         int position
236     )
237     {
238         return (DesignElementMap) this.designElementMaps.get(position);
239     }
240 
241     /**
242      *  Method to remove by position from DesignElementMaps_list
243      *  
244      */
245     public
246     void
247     removeElementAtFromDesignElementMaps(
248         int position
249     )
250     {
251         this.designElementMaps.removeElementAt(position);
252     }
253 
254     /**
255      *  Method to remove first DesignElementMap from 
256      *  DesignElementMaps_list
257      *  
258      */
259     public
260     void
261     removeFromDesignElementMaps(
262         DesignElementMap designElementMap
263     )
264     {
265         this.designElementMaps.remove(designElementMap);
266     }
267 
268 }