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