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