070ef7f076f741d675c92a73678cf3c79dd19cf6
[jalview.git] / src / jalview / schemabinding / version2 / JSeq.java
1 /*******************************************************************************
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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  * Class JSeq.
38  * 
39  * @version $Revision$ $Date$
40  */
41 public class JSeq implements java.io.Serializable
42 {
43
44   // --------------------------/
45   // - Class/Member Variables -/
46   // --------------------------/
47
48   /**
49    * Field _colour.
50    */
51   private int _colour;
52
53   /**
54    * keeps track of state for field: _colour
55    */
56   private boolean _has_colour;
57
58   /**
59    * Field _start.
60    */
61   private int _start;
62
63   /**
64    * keeps track of state for field: _start
65    */
66   private boolean _has_start;
67
68   /**
69    * Field _end.
70    */
71   private int _end;
72
73   /**
74    * keeps track of state for field: _end
75    */
76   private boolean _has_end;
77
78   /**
79    * Field _id.
80    */
81   private java.lang.String _id;
82
83   /**
84    * Field _hidden.
85    */
86   private boolean _hidden;
87
88   /**
89    * keeps track of state for field: _hidden
90    */
91   private boolean _has_hidden;
92
93   /**
94    * Field _featuresList.
95    */
96   private java.util.Vector _featuresList;
97
98   /**
99    * Field _pdbidsList.
100    */
101   private java.util.Vector _pdbidsList;
102
103   /**
104    * Field _hiddenSequencesList.
105    */
106   private java.util.Vector _hiddenSequencesList;
107
108   // ----------------/
109   // - Constructors -/
110   // ----------------/
111
112   public JSeq()
113   {
114     super();
115     this._featuresList = new java.util.Vector();
116     this._pdbidsList = new java.util.Vector();
117     this._hiddenSequencesList = new java.util.Vector();
118   }
119
120   // -----------/
121   // - Methods -/
122   // -----------/
123
124   /**
125    * 
126    * 
127    * @param vFeatures
128    * @throws java.lang.IndexOutOfBoundsException
129    *           if the index given is outside the bounds of the collection
130    */
131   public void addFeatures(
132           final jalview.schemabinding.version2.Features vFeatures)
133           throws java.lang.IndexOutOfBoundsException
134   {
135     this._featuresList.addElement(vFeatures);
136   }
137
138   /**
139    * 
140    * 
141    * @param index
142    * @param vFeatures
143    * @throws java.lang.IndexOutOfBoundsException
144    *           if the index given is outside the bounds of the collection
145    */
146   public void addFeatures(final int index,
147           final jalview.schemabinding.version2.Features vFeatures)
148           throws java.lang.IndexOutOfBoundsException
149   {
150     this._featuresList.add(index, vFeatures);
151   }
152
153   /**
154    * 
155    * 
156    * @param vHiddenSequences
157    * @throws java.lang.IndexOutOfBoundsException
158    *           if the index given is outside the bounds of the collection
159    */
160   public void addHiddenSequences(final int vHiddenSequences)
161           throws java.lang.IndexOutOfBoundsException
162   {
163     this._hiddenSequencesList.addElement(new java.lang.Integer(
164             vHiddenSequences));
165   }
166
167   /**
168    * 
169    * 
170    * @param index
171    * @param vHiddenSequences
172    * @throws java.lang.IndexOutOfBoundsException
173    *           if the index given is outside the bounds of the collection
174    */
175   public void addHiddenSequences(final int index, final int vHiddenSequences)
176           throws java.lang.IndexOutOfBoundsException
177   {
178     this._hiddenSequencesList.add(index, new java.lang.Integer(
179             vHiddenSequences));
180   }
181
182   /**
183    * 
184    * 
185    * @param vPdbids
186    * @throws java.lang.IndexOutOfBoundsException
187    *           if the index given is outside the bounds of the collection
188    */
189   public void addPdbids(final jalview.schemabinding.version2.Pdbids vPdbids)
190           throws java.lang.IndexOutOfBoundsException
191   {
192     this._pdbidsList.addElement(vPdbids);
193   }
194
195   /**
196    * 
197    * 
198    * @param index
199    * @param vPdbids
200    * @throws java.lang.IndexOutOfBoundsException
201    *           if the index given is outside the bounds of the collection
202    */
203   public void addPdbids(final int index,
204           final jalview.schemabinding.version2.Pdbids vPdbids)
205           throws java.lang.IndexOutOfBoundsException
206   {
207     this._pdbidsList.add(index, vPdbids);
208   }
209
210   /**
211      */
212   public void deleteColour()
213   {
214     this._has_colour = false;
215   }
216
217   /**
218      */
219   public void deleteEnd()
220   {
221     this._has_end = false;
222   }
223
224   /**
225      */
226   public void deleteHidden()
227   {
228     this._has_hidden = false;
229   }
230
231   /**
232      */
233   public void deleteStart()
234   {
235     this._has_start = false;
236   }
237
238   /**
239    * Method enumerateFeatures.
240    * 
241    * @return an Enumeration over all jalview.schemabinding.version2.Features
242    *         elements
243    */
244   public java.util.Enumeration enumerateFeatures()
245   {
246     return this._featuresList.elements();
247   }
248
249   /**
250    * Method enumerateHiddenSequences.
251    * 
252    * @return an Enumeration over all int elements
253    */
254   public java.util.Enumeration enumerateHiddenSequences()
255   {
256     return this._hiddenSequencesList.elements();
257   }
258
259   /**
260    * Method enumeratePdbids.
261    * 
262    * @return an Enumeration over all jalview.schemabinding.version2.Pdbids
263    *         elements
264    */
265   public java.util.Enumeration enumeratePdbids()
266   {
267     return this._pdbidsList.elements();
268   }
269
270   /**
271    * Returns the value of field 'colour'.
272    * 
273    * @return the value of field 'Colour'.
274    */
275   public int getColour()
276   {
277     return this._colour;
278   }
279
280   /**
281    * Returns the value of field 'end'.
282    * 
283    * @return the value of field 'End'.
284    */
285   public int getEnd()
286   {
287     return this._end;
288   }
289
290   /**
291    * Method getFeatures.
292    * 
293    * @param index
294    * @throws java.lang.IndexOutOfBoundsException
295    *           if the index given is outside the bounds of the collection
296    * @return the value of the jalview.schemabinding.version2.Features at the
297    *         given index
298    */
299   public jalview.schemabinding.version2.Features getFeatures(final int index)
300           throws java.lang.IndexOutOfBoundsException
301   {
302     // check bounds for index
303     if (index < 0 || index >= this._featuresList.size())
304     {
305       throw new IndexOutOfBoundsException("getFeatures: Index value '"
306               + index + "' not in range [0.."
307               + (this._featuresList.size() - 1) + "]");
308     }
309
310     return (jalview.schemabinding.version2.Features) _featuresList
311             .get(index);
312   }
313
314   /**
315    * Method getFeatures.Returns the contents of the collection in an Array.
316    * <p>
317    * Note: Just in case the collection contents are changing in another thread,
318    * we pass a 0-length Array of the correct type into the API call. This way we
319    * <i>know</i> that the Array returned is of exactly the correct length.
320    * 
321    * @return this collection as an Array
322    */
323   public jalview.schemabinding.version2.Features[] getFeatures()
324   {
325     jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
326     return (jalview.schemabinding.version2.Features[]) this._featuresList
327             .toArray(array);
328   }
329
330   /**
331    * Method getFeaturesCount.
332    * 
333    * @return the size of this collection
334    */
335   public int getFeaturesCount()
336   {
337     return this._featuresList.size();
338   }
339
340   /**
341    * Returns the value of field 'hidden'.
342    * 
343    * @return the value of field 'Hidden'.
344    */
345   public boolean getHidden()
346   {
347     return this._hidden;
348   }
349
350   /**
351    * Method getHiddenSequences.
352    * 
353    * @param index
354    * @throws java.lang.IndexOutOfBoundsException
355    *           if the index given is outside the bounds of the collection
356    * @return the value of the int at the given index
357    */
358   public int getHiddenSequences(final int index)
359           throws java.lang.IndexOutOfBoundsException
360   {
361     // check bounds for index
362     if (index < 0 || index >= this._hiddenSequencesList.size())
363     {
364       throw new IndexOutOfBoundsException(
365               "getHiddenSequences: Index value '" + index
366                       + "' not in range [0.."
367                       + (this._hiddenSequencesList.size() - 1) + "]");
368     }
369
370     return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
371   }
372
373   /**
374    * Method getHiddenSequences.Returns the contents of the collection in an
375    * Array.
376    * 
377    * @return this collection as an Array
378    */
379   public int[] getHiddenSequences()
380   {
381     int size = this._hiddenSequencesList.size();
382     int[] array = new int[size];
383     java.util.Iterator iter = _hiddenSequencesList.iterator();
384     for (int index = 0; index < size; index++)
385     {
386       array[index] = ((java.lang.Integer) iter.next()).intValue();
387     }
388     return array;
389   }
390
391   /**
392    * Method getHiddenSequencesCount.
393    * 
394    * @return the size of this collection
395    */
396   public int getHiddenSequencesCount()
397   {
398     return this._hiddenSequencesList.size();
399   }
400
401   /**
402    * Returns the value of field 'id'.
403    * 
404    * @return the value of field 'Id'.
405    */
406   public java.lang.String getId()
407   {
408     return this._id;
409   }
410
411   /**
412    * Method getPdbids.
413    * 
414    * @param index
415    * @throws java.lang.IndexOutOfBoundsException
416    *           if the index given is outside the bounds of the collection
417    * @return the value of the jalview.schemabinding.version2.Pdbids at the given
418    *         index
419    */
420   public jalview.schemabinding.version2.Pdbids getPdbids(final int index)
421           throws java.lang.IndexOutOfBoundsException
422   {
423     // check bounds for index
424     if (index < 0 || index >= this._pdbidsList.size())
425     {
426       throw new IndexOutOfBoundsException("getPdbids: Index value '"
427               + index + "' not in range [0.."
428               + (this._pdbidsList.size() - 1) + "]");
429     }
430
431     return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
432   }
433
434   /**
435    * Method getPdbids.Returns the contents of the collection in an Array.
436    * <p>
437    * Note: Just in case the collection contents are changing in another thread,
438    * we pass a 0-length Array of the correct type into the API call. This way we
439    * <i>know</i> that the Array returned is of exactly the correct length.
440    * 
441    * @return this collection as an Array
442    */
443   public jalview.schemabinding.version2.Pdbids[] getPdbids()
444   {
445     jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
446     return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList
447             .toArray(array);
448   }
449
450   /**
451    * Method getPdbidsCount.
452    * 
453    * @return the size of this collection
454    */
455   public int getPdbidsCount()
456   {
457     return this._pdbidsList.size();
458   }
459
460   /**
461    * Returns the value of field 'start'.
462    * 
463    * @return the value of field 'Start'.
464    */
465   public int getStart()
466   {
467     return this._start;
468   }
469
470   /**
471    * Method hasColour.
472    * 
473    * @return true if at least one Colour has been added
474    */
475   public boolean hasColour()
476   {
477     return this._has_colour;
478   }
479
480   /**
481    * Method hasEnd.
482    * 
483    * @return true if at least one End has been added
484    */
485   public boolean hasEnd()
486   {
487     return this._has_end;
488   }
489
490   /**
491    * Method hasHidden.
492    * 
493    * @return true if at least one Hidden has been added
494    */
495   public boolean hasHidden()
496   {
497     return this._has_hidden;
498   }
499
500   /**
501    * Method hasStart.
502    * 
503    * @return true if at least one Start has been added
504    */
505   public boolean hasStart()
506   {
507     return this._has_start;
508   }
509
510   /**
511    * Returns the value of field 'hidden'.
512    * 
513    * @return the value of field 'Hidden'.
514    */
515   public boolean isHidden()
516   {
517     return this._hidden;
518   }
519
520   /**
521    * Method isValid.
522    * 
523    * @return true if this object is valid according to the schema
524    */
525   public boolean isValid()
526   {
527     try
528     {
529       validate();
530     } catch (org.exolab.castor.xml.ValidationException vex)
531     {
532       return false;
533     }
534     return true;
535   }
536
537   /**
538    * 
539    * 
540    * @param out
541    * @throws org.exolab.castor.xml.MarshalException
542    *           if object is null or if any SAXException is thrown during
543    *           marshaling
544    * @throws org.exolab.castor.xml.ValidationException
545    *           if this object is an invalid instance according to the schema
546    */
547   public void marshal(final java.io.Writer out)
548           throws org.exolab.castor.xml.MarshalException,
549           org.exolab.castor.xml.ValidationException
550   {
551     Marshaller.marshal(this, out);
552   }
553
554   /**
555    * 
556    * 
557    * @param handler
558    * @throws java.io.IOException
559    *           if an IOException occurs during marshaling
560    * @throws org.exolab.castor.xml.ValidationException
561    *           if this object is an invalid instance according to the schema
562    * @throws org.exolab.castor.xml.MarshalException
563    *           if object is null or if any SAXException is thrown during
564    *           marshaling
565    */
566   public void marshal(final org.xml.sax.ContentHandler handler)
567           throws java.io.IOException,
568           org.exolab.castor.xml.MarshalException,
569           org.exolab.castor.xml.ValidationException
570   {
571     Marshaller.marshal(this, handler);
572   }
573
574   /**
575      */
576   public void removeAllFeatures()
577   {
578     this._featuresList.clear();
579   }
580
581   /**
582      */
583   public void removeAllHiddenSequences()
584   {
585     this._hiddenSequencesList.clear();
586   }
587
588   /**
589      */
590   public void removeAllPdbids()
591   {
592     this._pdbidsList.clear();
593   }
594
595   /**
596    * Method removeFeatures.
597    * 
598    * @param vFeatures
599    * @return true if the object was removed from the collection.
600    */
601   public boolean removeFeatures(
602           final jalview.schemabinding.version2.Features vFeatures)
603   {
604     boolean removed = _featuresList.remove(vFeatures);
605     return removed;
606   }
607
608   /**
609    * Method removeFeaturesAt.
610    * 
611    * @param index
612    * @return the element removed from the collection
613    */
614   public jalview.schemabinding.version2.Features removeFeaturesAt(
615           final int index)
616   {
617     java.lang.Object obj = this._featuresList.remove(index);
618     return (jalview.schemabinding.version2.Features) obj;
619   }
620
621   /**
622    * Method removeHiddenSequences.
623    * 
624    * @param vHiddenSequences
625    * @return true if the object was removed from the collection.
626    */
627   public boolean removeHiddenSequences(final int vHiddenSequences)
628   {
629     boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(
630             vHiddenSequences));
631     return removed;
632   }
633
634   /**
635    * Method removeHiddenSequencesAt.
636    * 
637    * @param index
638    * @return the element removed from the collection
639    */
640   public int removeHiddenSequencesAt(final int index)
641   {
642     java.lang.Object obj = this._hiddenSequencesList.remove(index);
643     return ((java.lang.Integer) obj).intValue();
644   }
645
646   /**
647    * Method removePdbids.
648    * 
649    * @param vPdbids
650    * @return true if the object was removed from the collection.
651    */
652   public boolean removePdbids(
653           final jalview.schemabinding.version2.Pdbids vPdbids)
654   {
655     boolean removed = _pdbidsList.remove(vPdbids);
656     return removed;
657   }
658
659   /**
660    * Method removePdbidsAt.
661    * 
662    * @param index
663    * @return the element removed from the collection
664    */
665   public jalview.schemabinding.version2.Pdbids removePdbidsAt(
666           final int index)
667   {
668     java.lang.Object obj = this._pdbidsList.remove(index);
669     return (jalview.schemabinding.version2.Pdbids) obj;
670   }
671
672   /**
673    * Sets the value of field 'colour'.
674    * 
675    * @param colour
676    *          the value of field 'colour'.
677    */
678   public void setColour(final int colour)
679   {
680     this._colour = colour;
681     this._has_colour = true;
682   }
683
684   /**
685    * Sets the value of field 'end'.
686    * 
687    * @param end
688    *          the value of field 'end'.
689    */
690   public void setEnd(final int end)
691   {
692     this._end = end;
693     this._has_end = true;
694   }
695
696   /**
697    * 
698    * 
699    * @param index
700    * @param vFeatures
701    * @throws java.lang.IndexOutOfBoundsException
702    *           if the index given is outside the bounds of the collection
703    */
704   public void setFeatures(final int index,
705           final jalview.schemabinding.version2.Features vFeatures)
706           throws java.lang.IndexOutOfBoundsException
707   {
708     // check bounds for index
709     if (index < 0 || index >= this._featuresList.size())
710     {
711       throw new IndexOutOfBoundsException("setFeatures: Index value '"
712               + index + "' not in range [0.."
713               + (this._featuresList.size() - 1) + "]");
714     }
715
716     this._featuresList.set(index, vFeatures);
717   }
718
719   /**
720    * 
721    * 
722    * @param vFeaturesArray
723    */
724   public void setFeatures(
725           final jalview.schemabinding.version2.Features[] vFeaturesArray)
726   {
727     // -- copy array
728     _featuresList.clear();
729
730     for (int i = 0; i < vFeaturesArray.length; i++)
731     {
732       this._featuresList.add(vFeaturesArray[i]);
733     }
734   }
735
736   /**
737    * Sets the value of field 'hidden'.
738    * 
739    * @param hidden
740    *          the value of field 'hidden'.
741    */
742   public void setHidden(final boolean hidden)
743   {
744     this._hidden = hidden;
745     this._has_hidden = true;
746   }
747
748   /**
749    * 
750    * 
751    * @param index
752    * @param vHiddenSequences
753    * @throws java.lang.IndexOutOfBoundsException
754    *           if the index given is outside the bounds of the collection
755    */
756   public void setHiddenSequences(final int index, final int vHiddenSequences)
757           throws java.lang.IndexOutOfBoundsException
758   {
759     // check bounds for index
760     if (index < 0 || index >= this._hiddenSequencesList.size())
761     {
762       throw new IndexOutOfBoundsException(
763               "setHiddenSequences: Index value '" + index
764                       + "' not in range [0.."
765                       + (this._hiddenSequencesList.size() - 1) + "]");
766     }
767
768     this._hiddenSequencesList.set(index, new java.lang.Integer(
769             vHiddenSequences));
770   }
771
772   /**
773    * 
774    * 
775    * @param vHiddenSequencesArray
776    */
777   public void setHiddenSequences(final int[] vHiddenSequencesArray)
778   {
779     // -- copy array
780     _hiddenSequencesList.clear();
781
782     for (int i = 0; i < vHiddenSequencesArray.length; i++)
783     {
784       this._hiddenSequencesList.add(new java.lang.Integer(
785               vHiddenSequencesArray[i]));
786     }
787   }
788
789   /**
790    * Sets the value of field 'id'.
791    * 
792    * @param id
793    *          the value of field 'id'.
794    */
795   public void setId(final java.lang.String id)
796   {
797     this._id = id;
798   }
799
800   /**
801    * 
802    * 
803    * @param index
804    * @param vPdbids
805    * @throws java.lang.IndexOutOfBoundsException
806    *           if the index given is outside the bounds of the collection
807    */
808   public void setPdbids(final int index,
809           final jalview.schemabinding.version2.Pdbids vPdbids)
810           throws java.lang.IndexOutOfBoundsException
811   {
812     // check bounds for index
813     if (index < 0 || index >= this._pdbidsList.size())
814     {
815       throw new IndexOutOfBoundsException("setPdbids: Index value '"
816               + index + "' not in range [0.."
817               + (this._pdbidsList.size() - 1) + "]");
818     }
819
820     this._pdbidsList.set(index, vPdbids);
821   }
822
823   /**
824    * 
825    * 
826    * @param vPdbidsArray
827    */
828   public void setPdbids(
829           final jalview.schemabinding.version2.Pdbids[] vPdbidsArray)
830   {
831     // -- copy array
832     _pdbidsList.clear();
833
834     for (int i = 0; i < vPdbidsArray.length; i++)
835     {
836       this._pdbidsList.add(vPdbidsArray[i]);
837     }
838   }
839
840   /**
841    * Sets the value of field 'start'.
842    * 
843    * @param start
844    *          the value of field 'start'.
845    */
846   public void setStart(final int start)
847   {
848     this._start = start;
849     this._has_start = true;
850   }
851
852   /**
853    * Method unmarshal.
854    * 
855    * @param reader
856    * @throws org.exolab.castor.xml.MarshalException
857    *           if object is null or if any SAXException is thrown during
858    *           marshaling
859    * @throws org.exolab.castor.xml.ValidationException
860    *           if this object is an invalid instance according to the schema
861    * @return the unmarshaled jalview.schemabinding.version2.JSeq
862    */
863   public static jalview.schemabinding.version2.JSeq unmarshal(
864           final java.io.Reader reader)
865           throws org.exolab.castor.xml.MarshalException,
866           org.exolab.castor.xml.ValidationException
867   {
868     return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(
869             jalview.schemabinding.version2.JSeq.class, reader);
870   }
871
872   /**
873    * 
874    * 
875    * @throws org.exolab.castor.xml.ValidationException
876    *           if this object is an invalid instance according to the schema
877    */
878   public void validate() throws org.exolab.castor.xml.ValidationException
879   {
880     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
881     validator.validate(this);
882   }
883
884 }