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

Quick Search    Search Deep

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