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