Merge branch 'feature/JAL-3063JAXB' into feature/JAL-3063jaxbNoCastor
[jalview.git] / src / jalview / binding / JSeq.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.binding;
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  * Class JSeq.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class JSeq implements java.io.Serializable
23 {
24
25   // --------------------------/
26   // - Class/Member Variables -/
27   // --------------------------/
28
29   /**
30    * Field _colour.
31    */
32   private int _colour;
33
34   /**
35    * keeps track of state for field: _colour
36    */
37   private boolean _has_colour;
38
39   /**
40    * Field _start.
41    */
42   private int _start;
43
44   /**
45    * keeps track of state for field: _start
46    */
47   private boolean _has_start;
48
49   /**
50    * Field _end.
51    */
52   private int _end;
53
54   /**
55    * keeps track of state for field: _end
56    */
57   private boolean _has_end;
58
59   /**
60    * Field _id.
61    */
62   private int _id;
63
64   /**
65    * keeps track of state for field: _id
66    */
67   private boolean _has_id;
68
69   /**
70    * Field _featuresList.
71    */
72   private java.util.Vector _featuresList;
73
74   /**
75    * Field _pdbidsList.
76    */
77   private java.util.Vector _pdbidsList;
78
79   // ----------------/
80   // - Constructors -/
81   // ----------------/
82
83   public JSeq()
84   {
85     super();
86     this._featuresList = new java.util.Vector();
87     this._pdbidsList = new java.util.Vector();
88   }
89
90   // -----------/
91   // - Methods -/
92   // -----------/
93
94   /**
95    * 
96    * 
97    * @param vFeatures
98    * @throws java.lang.IndexOutOfBoundsException
99    *           if the index given is outside the bounds of the collection
100    */
101   public void addFeatures(final jalview.binding.Features vFeatures)
102           throws java.lang.IndexOutOfBoundsException
103   {
104     this._featuresList.addElement(vFeatures);
105   }
106
107   /**
108    * 
109    * 
110    * @param index
111    * @param vFeatures
112    * @throws java.lang.IndexOutOfBoundsException
113    *           if the index given is outside the bounds of the collection
114    */
115   public void addFeatures(final int index,
116           final jalview.binding.Features vFeatures)
117           throws java.lang.IndexOutOfBoundsException
118   {
119     this._featuresList.add(index, vFeatures);
120   }
121
122   /**
123    * 
124    * 
125    * @param vPdbids
126    * @throws java.lang.IndexOutOfBoundsException
127    *           if the index given is outside the bounds of the collection
128    */
129   public void addPdbids(final jalview.binding.Pdbids vPdbids)
130           throws java.lang.IndexOutOfBoundsException
131   {
132     this._pdbidsList.addElement(vPdbids);
133   }
134
135   /**
136    * 
137    * 
138    * @param index
139    * @param vPdbids
140    * @throws java.lang.IndexOutOfBoundsException
141    *           if the index given is outside the bounds of the collection
142    */
143   public void addPdbids(final int index,
144           final jalview.binding.Pdbids vPdbids)
145           throws java.lang.IndexOutOfBoundsException
146   {
147     this._pdbidsList.add(index, vPdbids);
148   }
149
150   /**
151      */
152   public void deleteColour()
153   {
154     this._has_colour = false;
155   }
156
157   /**
158      */
159   public void deleteEnd()
160   {
161     this._has_end = false;
162   }
163
164   /**
165      */
166   public void deleteId()
167   {
168     this._has_id = false;
169   }
170
171   /**
172      */
173   public void deleteStart()
174   {
175     this._has_start = false;
176   }
177
178   /**
179    * Method enumerateFeatures.
180    * 
181    * @return an Enumeration over all jalview.binding.Features elements
182    */
183   public java.util.Enumeration enumerateFeatures()
184   {
185     return this._featuresList.elements();
186   }
187
188   /**
189    * Method enumeratePdbids.
190    * 
191    * @return an Enumeration over all jalview.binding.Pdbids elements
192    */
193   public java.util.Enumeration enumeratePdbids()
194   {
195     return this._pdbidsList.elements();
196   }
197
198   /**
199    * Returns the value of field 'colour'.
200    * 
201    * @return the value of field 'Colour'.
202    */
203   public int getColour()
204   {
205     return this._colour;
206   }
207
208   /**
209    * Returns the value of field 'end'.
210    * 
211    * @return the value of field 'End'.
212    */
213   public int getEnd()
214   {
215     return this._end;
216   }
217
218   /**
219    * Method getFeatures.
220    * 
221    * @param index
222    * @throws java.lang.IndexOutOfBoundsException
223    *           if the index given is outside the bounds of the collection
224    * @return the value of the jalview.binding.Features at the given index
225    */
226   public jalview.binding.Features getFeatures(final int index)
227           throws java.lang.IndexOutOfBoundsException
228   {
229     // check bounds for index
230     if (index < 0 || index >= this._featuresList.size())
231     {
232       throw new IndexOutOfBoundsException(
233               "getFeatures: Index value '" + index + "' not in range [0.."
234                       + (this._featuresList.size() - 1) + "]");
235     }
236
237     return (jalview.binding.Features) _featuresList.get(index);
238   }
239
240   /**
241    * Method getFeatures.Returns the contents of the collection in an Array.
242    * <p>
243    * Note: Just in case the collection contents are changing in another thread,
244    * we pass a 0-length Array of the correct type into the API call. This way we
245    * <i>know</i> that the Array returned is of exactly the correct length.
246    * 
247    * @return this collection as an Array
248    */
249   public jalview.binding.Features[] getFeatures()
250   {
251     jalview.binding.Features[] array = new jalview.binding.Features[0];
252     return (jalview.binding.Features[]) this._featuresList.toArray(array);
253   }
254
255   /**
256    * Method getFeaturesCount.
257    * 
258    * @return the size of this collection
259    */
260   public int getFeaturesCount()
261   {
262     return this._featuresList.size();
263   }
264
265   /**
266    * Returns the value of field 'id'.
267    * 
268    * @return the value of field 'Id'.
269    */
270   public int getId()
271   {
272     return this._id;
273   }
274
275   /**
276    * Method getPdbids.
277    * 
278    * @param index
279    * @throws java.lang.IndexOutOfBoundsException
280    *           if the index given is outside the bounds of the collection
281    * @return the value of the jalview.binding.Pdbids at the given index
282    */
283   public jalview.binding.Pdbids getPdbids(final int index)
284           throws java.lang.IndexOutOfBoundsException
285   {
286     // check bounds for index
287     if (index < 0 || index >= this._pdbidsList.size())
288     {
289       throw new IndexOutOfBoundsException(
290               "getPdbids: Index value '" + index + "' not in range [0.."
291                       + (this._pdbidsList.size() - 1) + "]");
292     }
293
294     return (jalview.binding.Pdbids) _pdbidsList.get(index);
295   }
296
297   /**
298    * Method getPdbids.Returns the contents of the collection in an Array.
299    * <p>
300    * Note: Just in case the collection contents are changing in another thread,
301    * we pass a 0-length Array of the correct type into the API call. This way we
302    * <i>know</i> that the Array returned is of exactly the correct length.
303    * 
304    * @return this collection as an Array
305    */
306   public jalview.binding.Pdbids[] getPdbids()
307   {
308     jalview.binding.Pdbids[] array = new jalview.binding.Pdbids[0];
309     return (jalview.binding.Pdbids[]) this._pdbidsList.toArray(array);
310   }
311
312   /**
313    * Method getPdbidsCount.
314    * 
315    * @return the size of this collection
316    */
317   public int getPdbidsCount()
318   {
319     return this._pdbidsList.size();
320   }
321
322   /**
323    * Returns the value of field 'start'.
324    * 
325    * @return the value of field 'Start'.
326    */
327   public int getStart()
328   {
329     return this._start;
330   }
331
332   /**
333    * Method hasColour.
334    * 
335    * @return true if at least one Colour has been added
336    */
337   public boolean hasColour()
338   {
339     return this._has_colour;
340   }
341
342   /**
343    * Method hasEnd.
344    * 
345    * @return true if at least one End has been added
346    */
347   public boolean hasEnd()
348   {
349     return this._has_end;
350   }
351
352   /**
353    * Method hasId.
354    * 
355    * @return true if at least one Id has been added
356    */
357   public boolean hasId()
358   {
359     return this._has_id;
360   }
361
362   /**
363    * Method hasStart.
364    * 
365    * @return true if at least one Start has been added
366    */
367   public boolean hasStart()
368   {
369     return this._has_start;
370   }
371
372   /**
373    * Method isValid.
374    * 
375    * @return true if this object is valid according to the schema
376    */
377   public boolean isValid()
378   {
379     try
380     {
381       validate();
382     } catch (org.exolab.castor.xml.ValidationException vex)
383     {
384       return false;
385     }
386     return true;
387   }
388
389   /**
390    * 
391    * 
392    * @param out
393    * @throws org.exolab.castor.xml.MarshalException
394    *           if object is null or if any SAXException is thrown during
395    *           marshaling
396    * @throws org.exolab.castor.xml.ValidationException
397    *           if this object is an invalid instance according to the schema
398    */
399   public void marshal(final java.io.Writer out)
400           throws org.exolab.castor.xml.MarshalException,
401           org.exolab.castor.xml.ValidationException
402   {
403     Marshaller.marshal(this, out);
404   }
405
406   /**
407    * 
408    * 
409    * @param handler
410    * @throws java.io.IOException
411    *           if an IOException occurs during marshaling
412    * @throws org.exolab.castor.xml.ValidationException
413    *           if this object is an invalid instance according to the schema
414    * @throws org.exolab.castor.xml.MarshalException
415    *           if object is null or if any SAXException is thrown during
416    *           marshaling
417    */
418   public void marshal(final org.xml.sax.ContentHandler handler)
419           throws java.io.IOException,
420           org.exolab.castor.xml.MarshalException,
421           org.exolab.castor.xml.ValidationException
422   {
423     Marshaller.marshal(this, handler);
424   }
425
426   /**
427      */
428   public void removeAllFeatures()
429   {
430     this._featuresList.clear();
431   }
432
433   /**
434      */
435   public void removeAllPdbids()
436   {
437     this._pdbidsList.clear();
438   }
439
440   /**
441    * Method removeFeatures.
442    * 
443    * @param vFeatures
444    * @return true if the object was removed from the collection.
445    */
446   public boolean removeFeatures(final jalview.binding.Features vFeatures)
447   {
448     boolean removed = _featuresList.remove(vFeatures);
449     return removed;
450   }
451
452   /**
453    * Method removeFeaturesAt.
454    * 
455    * @param index
456    * @return the element removed from the collection
457    */
458   public jalview.binding.Features removeFeaturesAt(final int index)
459   {
460     java.lang.Object obj = this._featuresList.remove(index);
461     return (jalview.binding.Features) obj;
462   }
463
464   /**
465    * Method removePdbids.
466    * 
467    * @param vPdbids
468    * @return true if the object was removed from the collection.
469    */
470   public boolean removePdbids(final jalview.binding.Pdbids vPdbids)
471   {
472     boolean removed = _pdbidsList.remove(vPdbids);
473     return removed;
474   }
475
476   /**
477    * Method removePdbidsAt.
478    * 
479    * @param index
480    * @return the element removed from the collection
481    */
482   public jalview.binding.Pdbids removePdbidsAt(final int index)
483   {
484     java.lang.Object obj = this._pdbidsList.remove(index);
485     return (jalview.binding.Pdbids) obj;
486   }
487
488   /**
489    * Sets the value of field 'colour'.
490    * 
491    * @param colour
492    *          the value of field 'colour'.
493    */
494   public void setColour(final int colour)
495   {
496     this._colour = colour;
497     this._has_colour = true;
498   }
499
500   /**
501    * Sets the value of field 'end'.
502    * 
503    * @param end
504    *          the value of field 'end'.
505    */
506   public void setEnd(final int end)
507   {
508     this._end = end;
509     this._has_end = true;
510   }
511
512   /**
513    * 
514    * 
515    * @param index
516    * @param vFeatures
517    * @throws java.lang.IndexOutOfBoundsException
518    *           if the index given is outside the bounds of the collection
519    */
520   public void setFeatures(final int index,
521           final jalview.binding.Features vFeatures)
522           throws java.lang.IndexOutOfBoundsException
523   {
524     // check bounds for index
525     if (index < 0 || index >= this._featuresList.size())
526     {
527       throw new IndexOutOfBoundsException(
528               "setFeatures: Index value '" + index + "' not in range [0.."
529                       + (this._featuresList.size() - 1) + "]");
530     }
531
532     this._featuresList.set(index, vFeatures);
533   }
534
535   /**
536    * 
537    * 
538    * @param vFeaturesArray
539    */
540   public void setFeatures(final jalview.binding.Features[] vFeaturesArray)
541   {
542     // -- copy array
543     _featuresList.clear();
544
545     for (int i = 0; i < vFeaturesArray.length; i++)
546     {
547       this._featuresList.add(vFeaturesArray[i]);
548     }
549   }
550
551   /**
552    * Sets the value of field 'id'.
553    * 
554    * @param id
555    *          the value of field 'id'.
556    */
557   public void setId(final int id)
558   {
559     this._id = id;
560     this._has_id = true;
561   }
562
563   /**
564    * 
565    * 
566    * @param index
567    * @param vPdbids
568    * @throws java.lang.IndexOutOfBoundsException
569    *           if the index given is outside the bounds of the collection
570    */
571   public void setPdbids(final int index,
572           final jalview.binding.Pdbids vPdbids)
573           throws java.lang.IndexOutOfBoundsException
574   {
575     // check bounds for index
576     if (index < 0 || index >= this._pdbidsList.size())
577     {
578       throw new IndexOutOfBoundsException(
579               "setPdbids: Index value '" + index + "' not in range [0.."
580                       + (this._pdbidsList.size() - 1) + "]");
581     }
582
583     this._pdbidsList.set(index, vPdbids);
584   }
585
586   /**
587    * 
588    * 
589    * @param vPdbidsArray
590    */
591   public void setPdbids(final jalview.binding.Pdbids[] vPdbidsArray)
592   {
593     // -- copy array
594     _pdbidsList.clear();
595
596     for (int i = 0; i < vPdbidsArray.length; i++)
597     {
598       this._pdbidsList.add(vPdbidsArray[i]);
599     }
600   }
601
602   /**
603    * Sets the value of field 'start'.
604    * 
605    * @param start
606    *          the value of field 'start'.
607    */
608   public void setStart(final int start)
609   {
610     this._start = start;
611     this._has_start = true;
612   }
613
614   /**
615    * Method unmarshal.
616    * 
617    * @param reader
618    * @throws org.exolab.castor.xml.MarshalException
619    *           if object is null or if any SAXException is thrown during
620    *           marshaling
621    * @throws org.exolab.castor.xml.ValidationException
622    *           if this object is an invalid instance according to the schema
623    * @return the unmarshaled jalview.binding.JSeq
624    */
625   public static jalview.binding.JSeq unmarshal(final java.io.Reader reader)
626           throws org.exolab.castor.xml.MarshalException,
627           org.exolab.castor.xml.ValidationException
628   {
629     return (jalview.binding.JSeq) Unmarshaller
630             .unmarshal(jalview.binding.JSeq.class, reader);
631   }
632
633   /**
634    * 
635    * 
636    * @throws org.exolab.castor.xml.ValidationException
637    *           if this object is an invalid instance according to the schema
638    */
639   public void validate() throws org.exolab.castor.xml.ValidationException
640   {
641     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
642     validator.validate(this);
643   }
644
645 }