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