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