21d56e7b14d9bad35af5c4ae756b726b08b13a0d
[jalview.git] / src / jalview / schemabinding / version2 / MapListType.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 jalview.schemabinding.version2;\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  * developed after mapRangeType from\r
19  * http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes\r
20  *  \r
21  *  This effectively represents a java.util.MapList object\r
22  *  \r
23  * \r
24  * @version $Revision$ $Date$\r
25  */\r
26 public class MapListType implements java.io.Serializable {\r
27 \r
28 \r
29       //--------------------------/\r
30      //- Class/Member Variables -/\r
31     //--------------------------/\r
32 \r
33     /**\r
34      * number of dictionary symbol widths involved in each\r
35      *  mapped position on this sequence (for example, 3 for a dna\r
36      * sequence exon\r
37      *  region that is being mapped to a protein sequence). This is\r
38      * optional,\r
39      *  since the unit can be usually be inferred from the\r
40      * dictionary type of\r
41      *  each sequence involved in the mapping. \r
42      */\r
43     private long _mapFromUnit;\r
44 \r
45     /**\r
46      * keeps track of state for field: _mapFromUnit\r
47      */\r
48     private boolean _has_mapFromUnit;\r
49 \r
50     /**\r
51      * number of dictionary symbol widths involved in each\r
52      *  mapped position on this sequence (for example, 3 for a dna\r
53      * sequence exon\r
54      *  region that is being mapped to a protein sequence). This is\r
55      * optional,\r
56      *  since the unit can be usually be inferred from the\r
57      * dictionary type of\r
58      *  each sequence involved in the mapping. \r
59      */\r
60     private long _mapToUnit;\r
61 \r
62     /**\r
63      * keeps track of state for field: _mapToUnit\r
64      */\r
65     private boolean _has_mapToUnit;\r
66 \r
67     /**\r
68      * a region from start to end inclusive\r
69      */\r
70     private java.util.Vector _mapListFromList;\r
71 \r
72     /**\r
73      * a region from start to end inclusive\r
74      */\r
75     private java.util.Vector _mapListToList;\r
76 \r
77 \r
78       //----------------/\r
79      //- Constructors -/\r
80     //----------------/\r
81 \r
82     public MapListType() {\r
83         super();\r
84         this._mapListFromList = new java.util.Vector();\r
85         this._mapListToList = new java.util.Vector();\r
86     }\r
87 \r
88 \r
89       //-----------/\r
90      //- Methods -/\r
91     //-----------/\r
92 \r
93     /**\r
94      * \r
95      * \r
96      * @param vMapListFrom\r
97      * @throws java.lang.IndexOutOfBoundsException if the index\r
98      * given is outside the bounds of the collection\r
99      */\r
100     public void addMapListFrom(\r
101             final jalview.schemabinding.version2.MapListFrom vMapListFrom)\r
102     throws java.lang.IndexOutOfBoundsException {\r
103         this._mapListFromList.addElement(vMapListFrom);\r
104     }\r
105 \r
106     /**\r
107      * \r
108      * \r
109      * @param index\r
110      * @param vMapListFrom\r
111      * @throws java.lang.IndexOutOfBoundsException if the index\r
112      * given is outside the bounds of the collection\r
113      */\r
114     public void addMapListFrom(\r
115             final int index,\r
116             final jalview.schemabinding.version2.MapListFrom vMapListFrom)\r
117     throws java.lang.IndexOutOfBoundsException {\r
118         this._mapListFromList.add(index, vMapListFrom);\r
119     }\r
120 \r
121     /**\r
122      * \r
123      * \r
124      * @param vMapListTo\r
125      * @throws java.lang.IndexOutOfBoundsException if the index\r
126      * given is outside the bounds of the collection\r
127      */\r
128     public void addMapListTo(\r
129             final jalview.schemabinding.version2.MapListTo vMapListTo)\r
130     throws java.lang.IndexOutOfBoundsException {\r
131         this._mapListToList.addElement(vMapListTo);\r
132     }\r
133 \r
134     /**\r
135      * \r
136      * \r
137      * @param index\r
138      * @param vMapListTo\r
139      * @throws java.lang.IndexOutOfBoundsException if the index\r
140      * given is outside the bounds of the collection\r
141      */\r
142     public void addMapListTo(\r
143             final int index,\r
144             final jalview.schemabinding.version2.MapListTo vMapListTo)\r
145     throws java.lang.IndexOutOfBoundsException {\r
146         this._mapListToList.add(index, vMapListTo);\r
147     }\r
148 \r
149     /**\r
150      */\r
151     public void deleteMapFromUnit(\r
152     ) {\r
153         this._has_mapFromUnit= false;\r
154     }\r
155 \r
156     /**\r
157      */\r
158     public void deleteMapToUnit(\r
159     ) {\r
160         this._has_mapToUnit= false;\r
161     }\r
162 \r
163     /**\r
164      * Method enumerateMapListFrom.\r
165      * \r
166      * @return an Enumeration over all\r
167      * jalview.schemabinding.version2.MapListFrom elements\r
168      */\r
169     public java.util.Enumeration enumerateMapListFrom(\r
170     ) {\r
171         return this._mapListFromList.elements();\r
172     }\r
173 \r
174     /**\r
175      * Method enumerateMapListTo.\r
176      * \r
177      * @return an Enumeration over all\r
178      * jalview.schemabinding.version2.MapListTo elements\r
179      */\r
180     public java.util.Enumeration enumerateMapListTo(\r
181     ) {\r
182         return this._mapListToList.elements();\r
183     }\r
184 \r
185     /**\r
186      * Returns the value of field 'mapFromUnit'. The field\r
187      * 'mapFromUnit' has the following description: number of\r
188      * dictionary symbol widths involved in each\r
189      *  mapped position on this sequence (for example, 3 for a dna\r
190      * sequence exon\r
191      *  region that is being mapped to a protein sequence). This is\r
192      * optional,\r
193      *  since the unit can be usually be inferred from the\r
194      * dictionary type of\r
195      *  each sequence involved in the mapping. \r
196      * \r
197      * @return the value of field 'MapFromUnit'.\r
198      */\r
199     public long getMapFromUnit(\r
200     ) {\r
201         return this._mapFromUnit;\r
202     }\r
203 \r
204     /**\r
205      * Method getMapListFrom.\r
206      * \r
207      * @param index\r
208      * @throws java.lang.IndexOutOfBoundsException if the index\r
209      * given is outside the bounds of the collection\r
210      * @return the value of the\r
211      * jalview.schemabinding.version2.MapListFrom at the given index\r
212      */\r
213     public jalview.schemabinding.version2.MapListFrom getMapListFrom(\r
214             final int index)\r
215     throws java.lang.IndexOutOfBoundsException {\r
216         // check bounds for index\r
217         if (index < 0 || index >= this._mapListFromList.size()) {\r
218             throw new IndexOutOfBoundsException("getMapListFrom: Index value '" + index + "' not in range [0.." + (this._mapListFromList.size() - 1) + "]");\r
219         }\r
220         \r
221         return (jalview.schemabinding.version2.MapListFrom) _mapListFromList.get(index);\r
222     }\r
223 \r
224     /**\r
225      * Method getMapListFrom.Returns the contents of the collection\r
226      * in an Array.  <p>Note:  Just in case the collection contents\r
227      * are changing in another thread, we pass a 0-length Array of\r
228      * the correct type into the API call.  This way we <i>know</i>\r
229      * that the Array returned is of exactly the correct length.\r
230      * \r
231      * @return this collection as an Array\r
232      */\r
233     public jalview.schemabinding.version2.MapListFrom[] getMapListFrom(\r
234     ) {\r
235         jalview.schemabinding.version2.MapListFrom[] array = new jalview.schemabinding.version2.MapListFrom[0];\r
236         return (jalview.schemabinding.version2.MapListFrom[]) this._mapListFromList.toArray(array);\r
237     }\r
238 \r
239     /**\r
240      * Method getMapListFromCount.\r
241      * \r
242      * @return the size of this collection\r
243      */\r
244     public int getMapListFromCount(\r
245     ) {\r
246         return this._mapListFromList.size();\r
247     }\r
248 \r
249     /**\r
250      * Method getMapListTo.\r
251      * \r
252      * @param index\r
253      * @throws java.lang.IndexOutOfBoundsException if the index\r
254      * given is outside the bounds of the collection\r
255      * @return the value of the\r
256      * jalview.schemabinding.version2.MapListTo at the given index\r
257      */\r
258     public jalview.schemabinding.version2.MapListTo getMapListTo(\r
259             final int index)\r
260     throws java.lang.IndexOutOfBoundsException {\r
261         // check bounds for index\r
262         if (index < 0 || index >= this._mapListToList.size()) {\r
263             throw new IndexOutOfBoundsException("getMapListTo: Index value '" + index + "' not in range [0.." + (this._mapListToList.size() - 1) + "]");\r
264         }\r
265         \r
266         return (jalview.schemabinding.version2.MapListTo) _mapListToList.get(index);\r
267     }\r
268 \r
269     /**\r
270      * Method getMapListTo.Returns the contents of the collection\r
271      * in an Array.  <p>Note:  Just in case the collection contents\r
272      * are changing in another thread, we pass a 0-length Array of\r
273      * the correct type into the API call.  This way we <i>know</i>\r
274      * that the Array returned is of exactly the correct length.\r
275      * \r
276      * @return this collection as an Array\r
277      */\r
278     public jalview.schemabinding.version2.MapListTo[] getMapListTo(\r
279     ) {\r
280         jalview.schemabinding.version2.MapListTo[] array = new jalview.schemabinding.version2.MapListTo[0];\r
281         return (jalview.schemabinding.version2.MapListTo[]) this._mapListToList.toArray(array);\r
282     }\r
283 \r
284     /**\r
285      * Method getMapListToCount.\r
286      * \r
287      * @return the size of this collection\r
288      */\r
289     public int getMapListToCount(\r
290     ) {\r
291         return this._mapListToList.size();\r
292     }\r
293 \r
294     /**\r
295      * Returns the value of field 'mapToUnit'. The field\r
296      * 'mapToUnit' has the following description: number of\r
297      * dictionary symbol widths involved in each\r
298      *  mapped position on this sequence (for example, 3 for a dna\r
299      * sequence exon\r
300      *  region that is being mapped to a protein sequence). This is\r
301      * optional,\r
302      *  since the unit can be usually be inferred from the\r
303      * dictionary type of\r
304      *  each sequence involved in the mapping. \r
305      * \r
306      * @return the value of field 'MapToUnit'.\r
307      */\r
308     public long getMapToUnit(\r
309     ) {\r
310         return this._mapToUnit;\r
311     }\r
312 \r
313     /**\r
314      * Method hasMapFromUnit.\r
315      * \r
316      * @return true if at least one MapFromUnit has been added\r
317      */\r
318     public boolean hasMapFromUnit(\r
319     ) {\r
320         return this._has_mapFromUnit;\r
321     }\r
322 \r
323     /**\r
324      * Method hasMapToUnit.\r
325      * \r
326      * @return true if at least one MapToUnit has been added\r
327      */\r
328     public boolean hasMapToUnit(\r
329     ) {\r
330         return this._has_mapToUnit;\r
331     }\r
332 \r
333     /**\r
334      * Method isValid.\r
335      * \r
336      * @return true if this object is valid according to the schema\r
337      */\r
338     public boolean isValid(\r
339     ) {\r
340         try {\r
341             validate();\r
342         } catch (org.exolab.castor.xml.ValidationException vex) {\r
343             return false;\r
344         }\r
345         return true;\r
346     }\r
347 \r
348     /**\r
349      * \r
350      * \r
351      * @param out\r
352      * @throws org.exolab.castor.xml.MarshalException if object is\r
353      * null or if any SAXException is thrown during marshaling\r
354      * @throws org.exolab.castor.xml.ValidationException if this\r
355      * object is an invalid instance according to the schema\r
356      */\r
357     public void marshal(\r
358             final java.io.Writer out)\r
359     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
360         Marshaller.marshal(this, out);\r
361     }\r
362 \r
363     /**\r
364      * \r
365      * \r
366      * @param handler\r
367      * @throws java.io.IOException if an IOException occurs during\r
368      * marshaling\r
369      * @throws org.exolab.castor.xml.ValidationException if this\r
370      * object is an invalid instance according to the schema\r
371      * @throws org.exolab.castor.xml.MarshalException if object is\r
372      * null or if any SAXException is thrown during marshaling\r
373      */\r
374     public void marshal(\r
375             final org.xml.sax.ContentHandler handler)\r
376     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
377         Marshaller.marshal(this, handler);\r
378     }\r
379 \r
380     /**\r
381      */\r
382     public void removeAllMapListFrom(\r
383     ) {\r
384         this._mapListFromList.clear();\r
385     }\r
386 \r
387     /**\r
388      */\r
389     public void removeAllMapListTo(\r
390     ) {\r
391         this._mapListToList.clear();\r
392     }\r
393 \r
394     /**\r
395      * Method removeMapListFrom.\r
396      * \r
397      * @param vMapListFrom\r
398      * @return true if the object was removed from the collection.\r
399      */\r
400     public boolean removeMapListFrom(\r
401             final jalview.schemabinding.version2.MapListFrom vMapListFrom) {\r
402         boolean removed = _mapListFromList.remove(vMapListFrom);\r
403         return removed;\r
404     }\r
405 \r
406     /**\r
407      * Method removeMapListFromAt.\r
408      * \r
409      * @param index\r
410      * @return the element removed from the collection\r
411      */\r
412     public jalview.schemabinding.version2.MapListFrom removeMapListFromAt(\r
413             final int index) {\r
414         java.lang.Object obj = this._mapListFromList.remove(index);\r
415         return (jalview.schemabinding.version2.MapListFrom) obj;\r
416     }\r
417 \r
418     /**\r
419      * Method removeMapListTo.\r
420      * \r
421      * @param vMapListTo\r
422      * @return true if the object was removed from the collection.\r
423      */\r
424     public boolean removeMapListTo(\r
425             final jalview.schemabinding.version2.MapListTo vMapListTo) {\r
426         boolean removed = _mapListToList.remove(vMapListTo);\r
427         return removed;\r
428     }\r
429 \r
430     /**\r
431      * Method removeMapListToAt.\r
432      * \r
433      * @param index\r
434      * @return the element removed from the collection\r
435      */\r
436     public jalview.schemabinding.version2.MapListTo removeMapListToAt(\r
437             final int index) {\r
438         java.lang.Object obj = this._mapListToList.remove(index);\r
439         return (jalview.schemabinding.version2.MapListTo) obj;\r
440     }\r
441 \r
442     /**\r
443      * Sets the value of field 'mapFromUnit'. The field\r
444      * 'mapFromUnit' has the following description: number of\r
445      * dictionary symbol widths involved in each\r
446      *  mapped position on this sequence (for example, 3 for a dna\r
447      * sequence exon\r
448      *  region that is being mapped to a protein sequence). This is\r
449      * optional,\r
450      *  since the unit can be usually be inferred from the\r
451      * dictionary type of\r
452      *  each sequence involved in the mapping. \r
453      * \r
454      * @param mapFromUnit the value of field 'mapFromUnit'.\r
455      */\r
456     public void setMapFromUnit(\r
457             final long mapFromUnit) {\r
458         this._mapFromUnit = mapFromUnit;\r
459         this._has_mapFromUnit = true;\r
460     }\r
461 \r
462     /**\r
463      * \r
464      * \r
465      * @param index\r
466      * @param vMapListFrom\r
467      * @throws java.lang.IndexOutOfBoundsException if the index\r
468      * given is outside the bounds of the collection\r
469      */\r
470     public void setMapListFrom(\r
471             final int index,\r
472             final jalview.schemabinding.version2.MapListFrom vMapListFrom)\r
473     throws java.lang.IndexOutOfBoundsException {\r
474         // check bounds for index\r
475         if (index < 0 || index >= this._mapListFromList.size()) {\r
476             throw new IndexOutOfBoundsException("setMapListFrom: Index value '" + index + "' not in range [0.." + (this._mapListFromList.size() - 1) + "]");\r
477         }\r
478         \r
479         this._mapListFromList.set(index, vMapListFrom);\r
480     }\r
481 \r
482     /**\r
483      * \r
484      * \r
485      * @param vMapListFromArray\r
486      */\r
487     public void setMapListFrom(\r
488             final jalview.schemabinding.version2.MapListFrom[] vMapListFromArray) {\r
489         //-- copy array\r
490         _mapListFromList.clear();\r
491         \r
492         for (int i = 0; i < vMapListFromArray.length; i++) {\r
493                 this._mapListFromList.add(vMapListFromArray[i]);\r
494         }\r
495     }\r
496 \r
497     /**\r
498      * \r
499      * \r
500      * @param index\r
501      * @param vMapListTo\r
502      * @throws java.lang.IndexOutOfBoundsException if the index\r
503      * given is outside the bounds of the collection\r
504      */\r
505     public void setMapListTo(\r
506             final int index,\r
507             final jalview.schemabinding.version2.MapListTo vMapListTo)\r
508     throws java.lang.IndexOutOfBoundsException {\r
509         // check bounds for index\r
510         if (index < 0 || index >= this._mapListToList.size()) {\r
511             throw new IndexOutOfBoundsException("setMapListTo: Index value '" + index + "' not in range [0.." + (this._mapListToList.size() - 1) + "]");\r
512         }\r
513         \r
514         this._mapListToList.set(index, vMapListTo);\r
515     }\r
516 \r
517     /**\r
518      * \r
519      * \r
520      * @param vMapListToArray\r
521      */\r
522     public void setMapListTo(\r
523             final jalview.schemabinding.version2.MapListTo[] vMapListToArray) {\r
524         //-- copy array\r
525         _mapListToList.clear();\r
526         \r
527         for (int i = 0; i < vMapListToArray.length; i++) {\r
528                 this._mapListToList.add(vMapListToArray[i]);\r
529         }\r
530     }\r
531 \r
532     /**\r
533      * Sets the value of field 'mapToUnit'. The field 'mapToUnit'\r
534      * has the following description: number of dictionary symbol\r
535      * widths involved in each\r
536      *  mapped position on this sequence (for example, 3 for a dna\r
537      * sequence exon\r
538      *  region that is being mapped to a protein sequence). This is\r
539      * optional,\r
540      *  since the unit can be usually be inferred from the\r
541      * dictionary type of\r
542      *  each sequence involved in the mapping. \r
543      * \r
544      * @param mapToUnit the value of field 'mapToUnit'.\r
545      */\r
546     public void setMapToUnit(\r
547             final long mapToUnit) {\r
548         this._mapToUnit = mapToUnit;\r
549         this._has_mapToUnit = true;\r
550     }\r
551 \r
552     /**\r
553      * Method unmarshal.\r
554      * \r
555      * @param reader\r
556      * @throws org.exolab.castor.xml.MarshalException if object is\r
557      * null or if any SAXException is thrown during marshaling\r
558      * @throws org.exolab.castor.xml.ValidationException if this\r
559      * object is an invalid instance according to the schema\r
560      * @return the unmarshaled\r
561      * jalview.schemabinding.version2.MapListType\r
562      */\r
563     public static jalview.schemabinding.version2.MapListType unmarshal(\r
564             final java.io.Reader reader)\r
565     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
566         return (jalview.schemabinding.version2.MapListType) Unmarshaller.unmarshal(jalview.schemabinding.version2.MapListType.class, reader);\r
567     }\r
568 \r
569     /**\r
570      * \r
571      * \r
572      * @throws org.exolab.castor.xml.ValidationException if this\r
573      * object is an invalid instance according to the schema\r
574      */\r
575     public void validate(\r
576     )\r
577     throws org.exolab.castor.xml.ValidationException {\r
578         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
579         validator.validate(this);\r
580     }\r
581 \r
582 }\r