removed old Mapping object dependency
[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.client.Vobject \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      * Field _sequenceA.\r
33      */\r
34     private java.lang.Object _sequenceA;\r
35 \r
36     /**\r
37      * Field _sequenceB.\r
38      */\r
39     private java.lang.Object _sequenceB;\r
40 \r
41     /**\r
42      * Field _id.\r
43      */\r
44     private java.lang.String _id;\r
45 \r
46     /**\r
47      * Field _rangeList.\r
48      */\r
49     private java.util.Vector _rangeList;\r
50 \r
51     /**\r
52      * Field _provenance.\r
53      */\r
54     private uk.ac.vamsas.objects.core.Provenance _provenance;\r
55 \r
56 \r
57       //----------------/\r
58      //- Constructors -/\r
59     //----------------/\r
60 \r
61     public SequenceMapping() {\r
62         super();\r
63         this._rangeList = new java.util.Vector();\r
64     }\r
65 \r
66 \r
67       //-----------/\r
68      //- Methods -/\r
69     //-----------/\r
70 \r
71     /**\r
72      * \r
73      * \r
74      * @param vRange\r
75      * @throws java.lang.IndexOutOfBoundsException if the index\r
76      * given is outside the bounds of the collection\r
77      */\r
78     public void addRange(\r
79             final uk.ac.vamsas.objects.core.Range vRange)\r
80     throws java.lang.IndexOutOfBoundsException {\r
81         this._rangeList.addElement(vRange);\r
82     }\r
83 \r
84     /**\r
85      * \r
86      * \r
87      * @param index\r
88      * @param vRange\r
89      * @throws java.lang.IndexOutOfBoundsException if the index\r
90      * given is outside the bounds of the collection\r
91      */\r
92     public void addRange(\r
93             final int index,\r
94             final uk.ac.vamsas.objects.core.Range vRange)\r
95     throws java.lang.IndexOutOfBoundsException {\r
96         this._rangeList.add(index, vRange);\r
97     }\r
98 \r
99     /**\r
100      * Method enumerateRange.\r
101      * \r
102      * @return an Enumeration over all\r
103      * uk.ac.vamsas.objects.core.Range elements\r
104      */\r
105     public java.util.Enumeration enumerateRange(\r
106     ) {\r
107         return this._rangeList.elements();\r
108     }\r
109 \r
110     /**\r
111      * Overrides the java.lang.Object.equals method.\r
112      * \r
113      * @param obj\r
114      * @return true if the objects are equal.\r
115      */\r
116     public boolean equals(\r
117             final java.lang.Object obj) {\r
118         if ( this == obj )\r
119             return true;\r
120         \r
121         if (super.equals(obj)==false)\r
122             return false;\r
123         \r
124         if (obj instanceof SequenceMapping) {\r
125         \r
126             SequenceMapping temp = (SequenceMapping)obj;\r
127             if (this._sequenceA != null) {\r
128                 if (temp._sequenceA == null) return false;\r
129                 else if (!(this._sequenceA.equals(temp._sequenceA))) \r
130                     return false;\r
131             }\r
132             else if (temp._sequenceA != null)\r
133                 return false;\r
134             if (this._sequenceB != null) {\r
135                 if (temp._sequenceB == null) return false;\r
136                 else if (!(this._sequenceB.equals(temp._sequenceB))) \r
137                     return false;\r
138             }\r
139             else if (temp._sequenceB != null)\r
140                 return false;\r
141             if (this._id != null) {\r
142                 if (temp._id == null) return false;\r
143                 else if (!(this._id.equals(temp._id))) \r
144                     return false;\r
145             }\r
146             else if (temp._id != null)\r
147                 return false;\r
148             if (this._rangeList != null) {\r
149                 if (temp._rangeList == null) return false;\r
150                 else if (!(this._rangeList.equals(temp._rangeList))) \r
151                     return false;\r
152             }\r
153             else if (temp._rangeList != null)\r
154                 return false;\r
155             if (this._provenance != null) {\r
156                 if (temp._provenance == null) return false;\r
157                 else if (!(this._provenance.equals(temp._provenance))) \r
158                     return false;\r
159             }\r
160             else if (temp._provenance != null)\r
161                 return false;\r
162             return true;\r
163         }\r
164         return false;\r
165     }\r
166 \r
167     /**\r
168      * Returns the value of field 'id'.\r
169      * \r
170      * @return the value of field 'Id'.\r
171      */\r
172     public java.lang.String getId(\r
173     ) {\r
174         return this._id;\r
175     }\r
176 \r
177     /**\r
178      * Returns the value of field 'provenance'.\r
179      * \r
180      * @return the value of field 'Provenance'.\r
181      */\r
182     public uk.ac.vamsas.objects.core.Provenance getProvenance(\r
183     ) {\r
184         return this._provenance;\r
185     }\r
186 \r
187     /**\r
188      * Method getRange.\r
189      * \r
190      * @param index\r
191      * @throws java.lang.IndexOutOfBoundsException if the index\r
192      * given is outside the bounds of the collection\r
193      * @return the value of the uk.ac.vamsas.objects.core.Range at\r
194      * the given index\r
195      */\r
196     public uk.ac.vamsas.objects.core.Range getRange(\r
197             final int index)\r
198     throws java.lang.IndexOutOfBoundsException {\r
199         // check bounds for index\r
200         if (index < 0 || index >= this._rangeList.size()) {\r
201             throw new IndexOutOfBoundsException("getRange: Index value '" + index + "' not in range [0.." + (this._rangeList.size() - 1) + "]");\r
202         }\r
203         \r
204         return (uk.ac.vamsas.objects.core.Range) _rangeList.get(index);\r
205     }\r
206 \r
207     /**\r
208      * Method getRange.Returns the contents of the collection in an\r
209      * Array.  <p>Note:  Just in case the collection contents are\r
210      * changing in another thread, we pass a 0-length Array of the\r
211      * correct type into the API call.  This way we <i>know</i>\r
212      * that the Array returned is of exactly the correct length.\r
213      * \r
214      * @return this collection as an Array\r
215      */\r
216     public uk.ac.vamsas.objects.core.Range[] getRange(\r
217     ) {\r
218         uk.ac.vamsas.objects.core.Range[] array = new uk.ac.vamsas.objects.core.Range[0];\r
219         return (uk.ac.vamsas.objects.core.Range[]) this._rangeList.toArray(array);\r
220     }\r
221 \r
222     /**\r
223      * Method getRangeAsReference.Returns a reference to\r
224      * '_rangeList'. No type checking is performed on any\r
225      * modifications to the Vector.\r
226      * \r
227      * @return a reference to the Vector backing this class\r
228      */\r
229     public java.util.Vector getRangeAsReference(\r
230     ) {\r
231         return this._rangeList;\r
232     }\r
233 \r
234     /**\r
235      * Method getRangeCount.\r
236      * \r
237      * @return the size of this collection\r
238      */\r
239     public int getRangeCount(\r
240     ) {\r
241         return this._rangeList.size();\r
242     }\r
243 \r
244     /**\r
245      * Returns the value of field 'sequenceA'.\r
246      * \r
247      * @return the value of field 'SequenceA'.\r
248      */\r
249     public java.lang.Object getSequenceA(\r
250     ) {\r
251         return this._sequenceA;\r
252     }\r
253 \r
254     /**\r
255      * Returns the value of field 'sequenceB'.\r
256      * \r
257      * @return the value of field 'SequenceB'.\r
258      */\r
259     public java.lang.Object getSequenceB(\r
260     ) {\r
261         return this._sequenceB;\r
262     }\r
263 \r
264     /**\r
265      * Overrides the java.lang.Object.hashCode method.\r
266      * <p>\r
267      * The following steps came from <b>Effective Java Programming\r
268      * Language Guide</b> by Joshua Bloch, Chapter 3\r
269      * \r
270      * @return a hash code value for the object.\r
271      */\r
272     public int hashCode(\r
273     ) {\r
274         int result = super.hashCode();\r
275         \r
276         long tmp;\r
277         if (_sequenceA != null) {\r
278            result = 37 * result + _sequenceA.hashCode();\r
279         }\r
280         if (_sequenceB != null) {\r
281            result = 37 * result + _sequenceB.hashCode();\r
282         }\r
283         if (_id != null) {\r
284            result = 37 * result + _id.hashCode();\r
285         }\r
286         if (_rangeList != null) {\r
287            result = 37 * result + _rangeList.hashCode();\r
288         }\r
289         if (_provenance != null) {\r
290            result = 37 * result + _provenance.hashCode();\r
291         }\r
292         \r
293         return result;\r
294     }\r
295 \r
296     /**\r
297      * Method isValid.\r
298      * \r
299      * @return true if this object is valid according to the schema\r
300      */\r
301     public boolean isValid(\r
302     ) {\r
303         try {\r
304             validate();\r
305         } catch (org.exolab.castor.xml.ValidationException vex) {\r
306             return false;\r
307         }\r
308         return true;\r
309     }\r
310 \r
311     /**\r
312      * \r
313      * \r
314      * @param out\r
315      * @throws org.exolab.castor.xml.MarshalException if object is\r
316      * null or if any SAXException is thrown during marshaling\r
317      * @throws org.exolab.castor.xml.ValidationException if this\r
318      * object is an invalid instance according to the schema\r
319      */\r
320     public void marshal(\r
321             final java.io.Writer out)\r
322     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
323         Marshaller.marshal(this, out);\r
324     }\r
325 \r
326     /**\r
327      * \r
328      * \r
329      * @param handler\r
330      * @throws java.io.IOException if an IOException occurs during\r
331      * marshaling\r
332      * @throws org.exolab.castor.xml.ValidationException if this\r
333      * object is an invalid instance according to the schema\r
334      * @throws org.exolab.castor.xml.MarshalException if object is\r
335      * null or if any SAXException is thrown during marshaling\r
336      */\r
337     public void marshal(\r
338             final org.xml.sax.ContentHandler handler)\r
339     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
340         Marshaller.marshal(this, handler);\r
341     }\r
342 \r
343     /**\r
344      */\r
345     public void removeAllRange(\r
346     ) {\r
347         this._rangeList.clear();\r
348     }\r
349 \r
350     /**\r
351      * Method removeRange.\r
352      * \r
353      * @param vRange\r
354      * @return true if the object was removed from the collection.\r
355      */\r
356     public boolean removeRange(\r
357             final uk.ac.vamsas.objects.core.Range vRange) {\r
358         boolean removed = _rangeList.remove(vRange);\r
359         return removed;\r
360     }\r
361 \r
362     /**\r
363      * Method removeRangeAt.\r
364      * \r
365      * @param index\r
366      * @return the element removed from the collection\r
367      */\r
368     public uk.ac.vamsas.objects.core.Range removeRangeAt(\r
369             final int index) {\r
370         java.lang.Object obj = this._rangeList.remove(index);\r
371         return (uk.ac.vamsas.objects.core.Range) obj;\r
372     }\r
373 \r
374     /**\r
375      * Sets the value of field 'id'.\r
376      * \r
377      * @param id the value of field 'id'.\r
378      */\r
379     public void setId(\r
380             final java.lang.String id) {\r
381         this._id = id;\r
382     }\r
383 \r
384     /**\r
385      * Sets the value of field 'provenance'.\r
386      * \r
387      * @param provenance the value of field 'provenance'.\r
388      */\r
389     public void setProvenance(\r
390             final uk.ac.vamsas.objects.core.Provenance provenance) {\r
391         this._provenance = provenance;\r
392     }\r
393 \r
394     /**\r
395      * \r
396      * \r
397      * @param index\r
398      * @param vRange\r
399      * @throws java.lang.IndexOutOfBoundsException if the index\r
400      * given is outside the bounds of the collection\r
401      */\r
402     public void setRange(\r
403             final int index,\r
404             final uk.ac.vamsas.objects.core.Range vRange)\r
405     throws java.lang.IndexOutOfBoundsException {\r
406         // check bounds for index\r
407         if (index < 0 || index >= this._rangeList.size()) {\r
408             throw new IndexOutOfBoundsException("setRange: Index value '" + index + "' not in range [0.." + (this._rangeList.size() - 1) + "]");\r
409         }\r
410         \r
411         this._rangeList.set(index, vRange);\r
412     }\r
413 \r
414     /**\r
415      * \r
416      * \r
417      * @param vRangeArray\r
418      */\r
419     public void setRange(\r
420             final uk.ac.vamsas.objects.core.Range[] vRangeArray) {\r
421         //-- copy array\r
422         _rangeList.clear();\r
423         \r
424         for (int i = 0; i < vRangeArray.length; i++) {\r
425                 this._rangeList.add(vRangeArray[i]);\r
426         }\r
427     }\r
428 \r
429     /**\r
430      * Sets the value of '_rangeList' by copying the given Vector.\r
431      * All elements will be checked for type safety.\r
432      * \r
433      * @param vRangeList the Vector to copy.\r
434      */\r
435     public void setRange(\r
436             final java.util.Vector vRangeList) {\r
437         // copy vector\r
438         this._rangeList.clear();\r
439         \r
440         this._rangeList.addAll(vRangeList);\r
441     }\r
442 \r
443     /**\r
444      * Sets the value of '_rangeList' by setting it to the given\r
445      * Vector. No type checking is performed.\r
446      * @deprecated\r
447      * \r
448      * @param rangeVector the Vector to set.\r
449      */\r
450     public void setRangeAsReference(\r
451             final java.util.Vector rangeVector) {\r
452         this._rangeList = rangeVector;\r
453     }\r
454 \r
455     /**\r
456      * Sets the value of field 'sequenceA'.\r
457      * \r
458      * @param sequenceA the value of field 'sequenceA'.\r
459      */\r
460     public void setSequenceA(\r
461             final java.lang.Object sequenceA) {\r
462         this._sequenceA = sequenceA;\r
463     }\r
464 \r
465     /**\r
466      * Sets the value of field 'sequenceB'.\r
467      * \r
468      * @param sequenceB the value of field 'sequenceB'.\r
469      */\r
470     public void setSequenceB(\r
471             final java.lang.Object sequenceB) {\r
472         this._sequenceB = sequenceB;\r
473     }\r
474 \r
475     /**\r
476      * Method unmarshal.\r
477      * \r
478      * @param reader\r
479      * @throws org.exolab.castor.xml.MarshalException if object is\r
480      * null or if any SAXException is thrown during marshaling\r
481      * @throws org.exolab.castor.xml.ValidationException if this\r
482      * object is an invalid instance according to the schema\r
483      * @return the unmarshaled\r
484      * uk.ac.vamsas.objects.core.SequenceMapping\r
485      */\r
486     public static uk.ac.vamsas.objects.core.SequenceMapping unmarshal(\r
487             final java.io.Reader reader)\r
488     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
489         return (uk.ac.vamsas.objects.core.SequenceMapping) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.SequenceMapping.class, reader);\r
490     }\r
491 \r
492     /**\r
493      * \r
494      * \r
495      * @throws org.exolab.castor.xml.ValidationException if this\r
496      * object is an invalid instance according to the schema\r
497      */\r
498     public void validate(\r
499     )\r
500     throws org.exolab.castor.xml.ValidationException {\r
501         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
502         validator.validate(this);\r
503     }\r
504 \r
505 }\r