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