7f7bcb0b0ffd30117ec9ae89dde8080eaab5a624
[vamsas.git] / src / uk / ac / vamsas / objects / core / SequenceMapping.java
1 /*\r
2  * This class was automatically generated with \r
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
4  * Schema.\r
5  * $Id$\r
6  */\r
7 \r
8 package uk.ac.vamsas.objects.core;\r
9 \r
10   //---------------------------------/\r
11  //- Imported classes and packages -/\r
12 //---------------------------------/\r
13 \r
14 import org.exolab.castor.xml.Marshaller;\r
15 import org.exolab.castor.xml.Unmarshaller;\r
16 \r
17 /**\r
18  * Class SequenceMapping.\r
19  * \r
20  * @version $Revision$ $Date$\r
21  */\r
22 public class SequenceMapping extends uk.ac.vamsas.objects.core.MapType \r
23 implements java.io.Serializable\r
24 {\r
25 \r
26 \r
27       //--------------------------/\r
28      //- Class/Member Variables -/\r
29     //--------------------------/\r
30 \r
31     /**\r
32      * Object on which the local\r
33      *  range is defined. \r
34      */\r
35     private java.lang.Object _loc;\r
36 \r
37     /**\r
38      * Object on which the mapped\r
39      *  range is defined. \r
40      */\r
41     private java.lang.Object _map;\r
42 \r
43     /**\r
44      * Field _id.\r
45      */\r
46     private java.lang.String _id;\r
47 \r
48     /**\r
49      * Field _provenance.\r
50      */\r
51     private uk.ac.vamsas.objects.core.Provenance _provenance;\r
52 \r
53 \r
54       //----------------/\r
55      //- Constructors -/\r
56     //----------------/\r
57 \r
58     public SequenceMapping() {\r
59         super();\r
60     }\r
61 \r
62 \r
63       //-----------/\r
64      //- Methods -/\r
65     //-----------/\r
66 \r
67     /**\r
68      * Overrides the java.lang.Object.equals method.\r
69      * \r
70      * @param obj\r
71      * @return true if the objects are equal.\r
72      */\r
73     public boolean equals(\r
74             final java.lang.Object obj) {\r
75         if ( this == obj )\r
76             return true;\r
77         \r
78         if (super.equals(obj)==false)\r
79             return false;\r
80         \r
81         if (obj instanceof SequenceMapping) {\r
82         \r
83             SequenceMapping temp = (SequenceMapping)obj;\r
84             boolean thcycle;\r
85             boolean tmcycle;\r
86             if (this._loc != null) {\r
87                 if (temp._loc == null) return false;\r
88                 if (this._loc != temp._loc) {\r
89                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._loc);\r
90                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._loc);\r
91                     if (thcycle!=tmcycle) {\r
92                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._loc); };\r
93                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc); };\r
94                         return false;\r
95                     }\r
96                     if (!thcycle) {\r
97                         if (!this._loc.equals(temp._loc)) {\r
98                             org.castor.util.CycleBreaker.releaseCycleHandle(this._loc);\r
99                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc);\r
100                             return false;\r
101                         }\r
102                         org.castor.util.CycleBreaker.releaseCycleHandle(this._loc);\r
103                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._loc);\r
104                     }\r
105                 }\r
106             } else if (temp._loc != null)\r
107                 return false;\r
108             if (this._map != null) {\r
109                 if (temp._map == null) return false;\r
110                 if (this._map != temp._map) {\r
111                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._map);\r
112                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._map);\r
113                     if (thcycle!=tmcycle) {\r
114                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._map); };\r
115                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._map); };\r
116                         return false;\r
117                     }\r
118                     if (!thcycle) {\r
119                         if (!this._map.equals(temp._map)) {\r
120                             org.castor.util.CycleBreaker.releaseCycleHandle(this._map);\r
121                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._map);\r
122                             return false;\r
123                         }\r
124                         org.castor.util.CycleBreaker.releaseCycleHandle(this._map);\r
125                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._map);\r
126                     }\r
127                 }\r
128             } else if (temp._map != null)\r
129                 return false;\r
130             if (this._id != null) {\r
131                 if (temp._id == null) return false;\r
132                 if (this._id != temp._id) {\r
133                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._id);\r
134                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._id);\r
135                     if (thcycle!=tmcycle) {\r
136                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._id); };\r
137                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._id); };\r
138                         return false;\r
139                     }\r
140                     if (!thcycle) {\r
141                         if (!this._id.equals(temp._id)) {\r
142                             org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
143                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
144                             return false;\r
145                         }\r
146                         org.castor.util.CycleBreaker.releaseCycleHandle(this._id);\r
147                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._id);\r
148                     }\r
149                 }\r
150             } else if (temp._id != null)\r
151                 return false;\r
152             if (this._provenance != null) {\r
153                 if (temp._provenance == null) return false;\r
154                 if (this._provenance != temp._provenance) {\r
155                     thcycle=org.castor.util.CycleBreaker.startingToCycle(this._provenance);\r
156                     tmcycle=org.castor.util.CycleBreaker.startingToCycle(temp._provenance);\r
157                     if (thcycle!=tmcycle) {\r
158                         if (!thcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance); };\r
159                         if (!tmcycle) { org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance); };\r
160                         return false;\r
161                     }\r
162                     if (!thcycle) {\r
163                         if (!this._provenance.equals(temp._provenance)) {\r
164                             org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
165                             org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
166                             return false;\r
167                         }\r
168                         org.castor.util.CycleBreaker.releaseCycleHandle(this._provenance);\r
169                         org.castor.util.CycleBreaker.releaseCycleHandle(temp._provenance);\r
170                     }\r
171                 }\r
172             } else if (temp._provenance != null)\r
173                 return false;\r
174             return true;\r
175         }\r
176         return false;\r
177     }\r
178 \r
179     /**\r
180      * Returns the value of field 'id'.\r
181      * \r
182      * @return the value of field 'Id'.\r
183      */\r
184     public java.lang.String getId(\r
185     ) {\r
186         return this._id;\r
187     }\r
188 \r
189     /**\r
190      * Returns the value of field 'loc'. The field 'loc' has the\r
191      * following description: Object on which the local\r
192      *  range is defined. \r
193      * \r
194      * @return the value of field 'Loc'.\r
195      */\r
196     public java.lang.Object getLoc(\r
197     ) {\r
198         return this._loc;\r
199     }\r
200 \r
201     /**\r
202      * Returns the value of field 'map'. The field 'map' has the\r
203      * following description: Object on which the mapped\r
204      *  range is defined. \r
205      * \r
206      * @return the value of field 'Map'.\r
207      */\r
208     public java.lang.Object getMap(\r
209     ) {\r
210         return this._map;\r
211     }\r
212 \r
213     /**\r
214      * Returns the value of field 'provenance'.\r
215      * \r
216      * @return the value of field 'Provenance'.\r
217      */\r
218     public uk.ac.vamsas.objects.core.Provenance getProvenance(\r
219     ) {\r
220         return this._provenance;\r
221     }\r
222 \r
223     /**\r
224      * Overrides the java.lang.Object.hashCode method.\r
225      * <p>\r
226      * The following steps came from <b>Effective Java Programming\r
227      * Language Guide</b> by Joshua Bloch, Chapter 3\r
228      * \r
229      * @return a hash code value for the object.\r
230      */\r
231     public int hashCode(\r
232     ) {\r
233         int result = super.hashCode();\r
234         \r
235         long tmp;\r
236         if (_loc != null\r
237             && !org.castor.util.CycleBreaker.startingToCycle(_loc)) {\r
238            result = 37 * result + _loc.hashCode();\r
239            org.castor.util.CycleBreaker.releaseCycleHandle(_loc);\r
240         }\r
241         if (_map != null\r
242             && !org.castor.util.CycleBreaker.startingToCycle(_map)) {\r
243            result = 37 * result + _map.hashCode();\r
244            org.castor.util.CycleBreaker.releaseCycleHandle(_map);\r
245         }\r
246         if (_id != null\r
247             && !org.castor.util.CycleBreaker.startingToCycle(_id)) {\r
248            result = 37 * result + _id.hashCode();\r
249            org.castor.util.CycleBreaker.releaseCycleHandle(_id);\r
250         }\r
251         if (_provenance != null\r
252             && !org.castor.util.CycleBreaker.startingToCycle(_provenance)) {\r
253            result = 37 * result + _provenance.hashCode();\r
254            org.castor.util.CycleBreaker.releaseCycleHandle(_provenance);\r
255         }\r
256         \r
257         return result;\r
258     }\r
259 \r
260     /**\r
261      * Method isValid.\r
262      * \r
263      * @return true if this object is valid according to the schema\r
264      */\r
265     public boolean isValid(\r
266     ) {\r
267         try {\r
268             validate();\r
269         } catch (org.exolab.castor.xml.ValidationException vex) {\r
270             return false;\r
271         }\r
272         return true;\r
273     }\r
274 \r
275     /**\r
276      * \r
277      * \r
278      * @param out\r
279      * @throws org.exolab.castor.xml.MarshalException if object is\r
280      * null or if any SAXException is thrown during marshaling\r
281      * @throws org.exolab.castor.xml.ValidationException if this\r
282      * object is an invalid instance according to the schema\r
283      */\r
284     public void marshal(\r
285             final java.io.Writer out)\r
286     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
287         Marshaller.marshal(this, out);\r
288     }\r
289 \r
290     /**\r
291      * \r
292      * \r
293      * @param handler\r
294      * @throws java.io.IOException if an IOException occurs during\r
295      * marshaling\r
296      * @throws org.exolab.castor.xml.ValidationException if this\r
297      * object is an invalid instance according to the schema\r
298      * @throws org.exolab.castor.xml.MarshalException if object is\r
299      * null or if any SAXException is thrown during marshaling\r
300      */\r
301     public void marshal(\r
302             final org.xml.sax.ContentHandler handler)\r
303     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
304         Marshaller.marshal(this, handler);\r
305     }\r
306 \r
307     /**\r
308      * Sets the value of field 'id'.\r
309      * \r
310      * @param id the value of field 'id'.\r
311      */\r
312     public void setId(\r
313             final java.lang.String id) {\r
314         this._id = id;\r
315     }\r
316 \r
317     /**\r
318      * Sets the value of field 'loc'. The field 'loc' has the\r
319      * following description: Object on which the local\r
320      *  range is defined. \r
321      * \r
322      * @param loc the value of field 'loc'.\r
323      */\r
324     public void setLoc(\r
325             final java.lang.Object loc) {\r
326         this._loc = loc;\r
327     }\r
328 \r
329     /**\r
330      * Sets the value of field 'map'. The field 'map' has the\r
331      * following description: Object on which the mapped\r
332      *  range is defined. \r
333      * \r
334      * @param map the value of field 'map'.\r
335      */\r
336     public void setMap(\r
337             final java.lang.Object map) {\r
338         this._map = map;\r
339     }\r
340 \r
341     /**\r
342      * Sets the value of field 'provenance'.\r
343      * \r
344      * @param provenance the value of field 'provenance'.\r
345      */\r
346     public void setProvenance(\r
347             final uk.ac.vamsas.objects.core.Provenance provenance) {\r
348         this._provenance = provenance;\r
349     }\r
350 \r
351     /**\r
352      * Method unmarshal.\r
353      * \r
354      * @param reader\r
355      * @throws org.exolab.castor.xml.MarshalException if object is\r
356      * null or if any SAXException is thrown during marshaling\r
357      * @throws org.exolab.castor.xml.ValidationException if this\r
358      * object is an invalid instance according to the schema\r
359      * @return the unmarshaled uk.ac.vamsas.objects.core.MapType\r
360      */\r
361     public static uk.ac.vamsas.objects.core.MapType unmarshal(\r
362             final java.io.Reader reader)\r
363     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
364         return (uk.ac.vamsas.objects.core.MapType) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceMapping.class, reader);\r
365     }\r
366 \r
367     /**\r
368      * \r
369      * \r
370      * @throws org.exolab.castor.xml.ValidationException if this\r
371      * object is an invalid instance according to the schema\r
372      */\r
373     public void validate(\r
374     )\r
375     throws org.exolab.castor.xml.ValidationException {\r
376         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
377         validator.validate(this);\r
378     }\r
379 \r
380 }\r