Copyright test
[jalview.git] / src / jalview / binding / JGroup.java
1 /*******************************************************************************
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $(date) 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
10  * of the License, or (at your option) any later version.
11  *   
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  *******************************************************************************/
21 /*
22  * This class was automatically generated with 
23  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
24  * Schema.
25  * $Id$
26  */
27
28 package jalview.binding;
29
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
33
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
36
37 /**
38  * Class JGroup.
39  * 
40  * @version $Revision$ $Date$
41  */
42 public class JGroup implements java.io.Serializable
43 {
44
45   // --------------------------/
46   // - Class/Member Variables -/
47   // --------------------------/
48
49   /**
50    * Field _start.
51    */
52   private int _start;
53
54   /**
55    * keeps track of state for field: _start
56    */
57   private boolean _has_start;
58
59   /**
60    * Field _end.
61    */
62   private int _end;
63
64   /**
65    * keeps track of state for field: _end
66    */
67   private boolean _has_end;
68
69   /**
70    * Field _name.
71    */
72   private java.lang.String _name;
73
74   /**
75    * Field _colour.
76    */
77   private java.lang.String _colour;
78
79   /**
80    * Field _consThreshold.
81    */
82   private int _consThreshold;
83
84   /**
85    * keeps track of state for field: _consThreshold
86    */
87   private boolean _has_consThreshold;
88
89   /**
90    * Field _pidThreshold.
91    */
92   private int _pidThreshold;
93
94   /**
95    * keeps track of state for field: _pidThreshold
96    */
97   private boolean _has_pidThreshold;
98
99   /**
100    * Field _outlineColour.
101    */
102   private int _outlineColour;
103
104   /**
105    * keeps track of state for field: _outlineColour
106    */
107   private boolean _has_outlineColour;
108
109   /**
110    * Field _displayBoxes.
111    */
112   private boolean _displayBoxes;
113
114   /**
115    * keeps track of state for field: _displayBoxes
116    */
117   private boolean _has_displayBoxes;
118
119   /**
120    * Field _displayText.
121    */
122   private boolean _displayText;
123
124   /**
125    * keeps track of state for field: _displayText
126    */
127   private boolean _has_displayText;
128
129   /**
130    * Field _colourText.
131    */
132   private boolean _colourText;
133
134   /**
135    * keeps track of state for field: _colourText
136    */
137   private boolean _has_colourText;
138
139   /**
140    * Field _seqList.
141    */
142   private java.util.Vector _seqList;
143
144   // ----------------/
145   // - Constructors -/
146   // ----------------/
147
148   public JGroup()
149   {
150     super();
151     this._seqList = new java.util.Vector();
152   }
153
154   // -----------/
155   // - Methods -/
156   // -----------/
157
158   /**
159    * 
160    * 
161    * @param vSeq
162    * @throws java.lang.IndexOutOfBoundsException
163    *           if the index given is outside the bounds of the collection
164    */
165   public void addSeq(final int vSeq)
166           throws java.lang.IndexOutOfBoundsException
167   {
168     this._seqList.addElement(new java.lang.Integer(vSeq));
169   }
170
171   /**
172    * 
173    * 
174    * @param index
175    * @param vSeq
176    * @throws java.lang.IndexOutOfBoundsException
177    *           if the index given is outside the bounds of the collection
178    */
179   public void addSeq(final int index, final int vSeq)
180           throws java.lang.IndexOutOfBoundsException
181   {
182     this._seqList.add(index, new java.lang.Integer(vSeq));
183   }
184
185   /**
186      */
187   public void deleteColourText()
188   {
189     this._has_colourText = false;
190   }
191
192   /**
193      */
194   public void deleteConsThreshold()
195   {
196     this._has_consThreshold = false;
197   }
198
199   /**
200      */
201   public void deleteDisplayBoxes()
202   {
203     this._has_displayBoxes = false;
204   }
205
206   /**
207      */
208   public void deleteDisplayText()
209   {
210     this._has_displayText = false;
211   }
212
213   /**
214      */
215   public void deleteEnd()
216   {
217     this._has_end = false;
218   }
219
220   /**
221      */
222   public void deleteOutlineColour()
223   {
224     this._has_outlineColour = false;
225   }
226
227   /**
228      */
229   public void deletePidThreshold()
230   {
231     this._has_pidThreshold = false;
232   }
233
234   /**
235      */
236   public void deleteStart()
237   {
238     this._has_start = false;
239   }
240
241   /**
242    * Method enumerateSeq.
243    * 
244    * @return an Enumeration over all int elements
245    */
246   public java.util.Enumeration enumerateSeq()
247   {
248     return this._seqList.elements();
249   }
250
251   /**
252    * Returns the value of field 'colour'.
253    * 
254    * @return the value of field 'Colour'.
255    */
256   public java.lang.String getColour()
257   {
258     return this._colour;
259   }
260
261   /**
262    * Returns the value of field 'colourText'.
263    * 
264    * @return the value of field 'ColourText'.
265    */
266   public boolean getColourText()
267   {
268     return this._colourText;
269   }
270
271   /**
272    * Returns the value of field 'consThreshold'.
273    * 
274    * @return the value of field 'ConsThreshold'.
275    */
276   public int getConsThreshold()
277   {
278     return this._consThreshold;
279   }
280
281   /**
282    * Returns the value of field 'displayBoxes'.
283    * 
284    * @return the value of field 'DisplayBoxes'.
285    */
286   public boolean getDisplayBoxes()
287   {
288     return this._displayBoxes;
289   }
290
291   /**
292    * Returns the value of field 'displayText'.
293    * 
294    * @return the value of field 'DisplayText'.
295    */
296   public boolean getDisplayText()
297   {
298     return this._displayText;
299   }
300
301   /**
302    * Returns the value of field 'end'.
303    * 
304    * @return the value of field 'End'.
305    */
306   public int getEnd()
307   {
308     return this._end;
309   }
310
311   /**
312    * Returns the value of field 'name'.
313    * 
314    * @return the value of field 'Name'.
315    */
316   public java.lang.String getName()
317   {
318     return this._name;
319   }
320
321   /**
322    * Returns the value of field 'outlineColour'.
323    * 
324    * @return the value of field 'OutlineColour'.
325    */
326   public int getOutlineColour()
327   {
328     return this._outlineColour;
329   }
330
331   /**
332    * Returns the value of field 'pidThreshold'.
333    * 
334    * @return the value of field 'PidThreshold'.
335    */
336   public int getPidThreshold()
337   {
338     return this._pidThreshold;
339   }
340
341   /**
342    * Method getSeq.
343    * 
344    * @param index
345    * @throws java.lang.IndexOutOfBoundsException
346    *           if the index given is outside the bounds of the collection
347    * @return the value of the int at the given index
348    */
349   public int getSeq(final int index)
350           throws java.lang.IndexOutOfBoundsException
351   {
352     // check bounds for index
353     if (index < 0 || index >= this._seqList.size())
354     {
355       throw new IndexOutOfBoundsException("getSeq: Index value '" + index
356               + "' not in range [0.." + (this._seqList.size() - 1) + "]");
357     }
358
359     return ((java.lang.Integer) _seqList.get(index)).intValue();
360   }
361
362   /**
363    * Method getSeq.Returns the contents of the collection in an Array.
364    * 
365    * @return this collection as an Array
366    */
367   public int[] getSeq()
368   {
369     int size = this._seqList.size();
370     int[] array = new int[size];
371     java.util.Iterator iter = _seqList.iterator();
372     for (int index = 0; index < size; index++)
373     {
374       array[index] = ((java.lang.Integer) iter.next()).intValue();
375     }
376     return array;
377   }
378
379   /**
380    * Method getSeqCount.
381    * 
382    * @return the size of this collection
383    */
384   public int getSeqCount()
385   {
386     return this._seqList.size();
387   }
388
389   /**
390    * Returns the value of field 'start'.
391    * 
392    * @return the value of field 'Start'.
393    */
394   public int getStart()
395   {
396     return this._start;
397   }
398
399   /**
400    * Method hasColourText.
401    * 
402    * @return true if at least one ColourText has been added
403    */
404   public boolean hasColourText()
405   {
406     return this._has_colourText;
407   }
408
409   /**
410    * Method hasConsThreshold.
411    * 
412    * @return true if at least one ConsThreshold has been added
413    */
414   public boolean hasConsThreshold()
415   {
416     return this._has_consThreshold;
417   }
418
419   /**
420    * Method hasDisplayBoxes.
421    * 
422    * @return true if at least one DisplayBoxes has been added
423    */
424   public boolean hasDisplayBoxes()
425   {
426     return this._has_displayBoxes;
427   }
428
429   /**
430    * Method hasDisplayText.
431    * 
432    * @return true if at least one DisplayText has been added
433    */
434   public boolean hasDisplayText()
435   {
436     return this._has_displayText;
437   }
438
439   /**
440    * Method hasEnd.
441    * 
442    * @return true if at least one End has been added
443    */
444   public boolean hasEnd()
445   {
446     return this._has_end;
447   }
448
449   /**
450    * Method hasOutlineColour.
451    * 
452    * @return true if at least one OutlineColour has been added
453    */
454   public boolean hasOutlineColour()
455   {
456     return this._has_outlineColour;
457   }
458
459   /**
460    * Method hasPidThreshold.
461    * 
462    * @return true if at least one PidThreshold has been added
463    */
464   public boolean hasPidThreshold()
465   {
466     return this._has_pidThreshold;
467   }
468
469   /**
470    * Method hasStart.
471    * 
472    * @return true if at least one Start has been added
473    */
474   public boolean hasStart()
475   {
476     return this._has_start;
477   }
478
479   /**
480    * Returns the value of field 'colourText'.
481    * 
482    * @return the value of field 'ColourText'.
483    */
484   public boolean isColourText()
485   {
486     return this._colourText;
487   }
488
489   /**
490    * Returns the value of field 'displayBoxes'.
491    * 
492    * @return the value of field 'DisplayBoxes'.
493    */
494   public boolean isDisplayBoxes()
495   {
496     return this._displayBoxes;
497   }
498
499   /**
500    * Returns the value of field 'displayText'.
501    * 
502    * @return the value of field 'DisplayText'.
503    */
504   public boolean isDisplayText()
505   {
506     return this._displayText;
507   }
508
509   /**
510    * Method isValid.
511    * 
512    * @return true if this object is valid according to the schema
513    */
514   public boolean isValid()
515   {
516     try
517     {
518       validate();
519     } catch (org.exolab.castor.xml.ValidationException vex)
520     {
521       return false;
522     }
523     return true;
524   }
525
526   /**
527    * 
528    * 
529    * @param out
530    * @throws org.exolab.castor.xml.MarshalException
531    *           if object is null or if any SAXException is thrown during
532    *           marshaling
533    * @throws org.exolab.castor.xml.ValidationException
534    *           if this object is an invalid instance according to the schema
535    */
536   public void marshal(final java.io.Writer out)
537           throws org.exolab.castor.xml.MarshalException,
538           org.exolab.castor.xml.ValidationException
539   {
540     Marshaller.marshal(this, out);
541   }
542
543   /**
544    * 
545    * 
546    * @param handler
547    * @throws java.io.IOException
548    *           if an IOException occurs during marshaling
549    * @throws org.exolab.castor.xml.ValidationException
550    *           if this object is an invalid instance according to the schema
551    * @throws org.exolab.castor.xml.MarshalException
552    *           if object is null or if any SAXException is thrown during
553    *           marshaling
554    */
555   public void marshal(final org.xml.sax.ContentHandler handler)
556           throws java.io.IOException,
557           org.exolab.castor.xml.MarshalException,
558           org.exolab.castor.xml.ValidationException
559   {
560     Marshaller.marshal(this, handler);
561   }
562
563   /**
564      */
565   public void removeAllSeq()
566   {
567     this._seqList.clear();
568   }
569
570   /**
571    * Method removeSeq.
572    * 
573    * @param vSeq
574    * @return true if the object was removed from the collection.
575    */
576   public boolean removeSeq(final int vSeq)
577   {
578     boolean removed = _seqList.remove(new java.lang.Integer(vSeq));
579     return removed;
580   }
581
582   /**
583    * Method removeSeqAt.
584    * 
585    * @param index
586    * @return the element removed from the collection
587    */
588   public int removeSeqAt(final int index)
589   {
590     java.lang.Object obj = this._seqList.remove(index);
591     return ((java.lang.Integer) obj).intValue();
592   }
593
594   /**
595    * Sets the value of field 'colour'.
596    * 
597    * @param colour
598    *          the value of field 'colour'.
599    */
600   public void setColour(final java.lang.String colour)
601   {
602     this._colour = colour;
603   }
604
605   /**
606    * Sets the value of field 'colourText'.
607    * 
608    * @param colourText
609    *          the value of field 'colourText'.
610    */
611   public void setColourText(final boolean colourText)
612   {
613     this._colourText = colourText;
614     this._has_colourText = true;
615   }
616
617   /**
618    * Sets the value of field 'consThreshold'.
619    * 
620    * @param consThreshold
621    *          the value of field 'consThreshold'.
622    */
623   public void setConsThreshold(final int consThreshold)
624   {
625     this._consThreshold = consThreshold;
626     this._has_consThreshold = true;
627   }
628
629   /**
630    * Sets the value of field 'displayBoxes'.
631    * 
632    * @param displayBoxes
633    *          the value of field 'displayBoxes'.
634    */
635   public void setDisplayBoxes(final boolean displayBoxes)
636   {
637     this._displayBoxes = displayBoxes;
638     this._has_displayBoxes = true;
639   }
640
641   /**
642    * Sets the value of field 'displayText'.
643    * 
644    * @param displayText
645    *          the value of field 'displayText'.
646    */
647   public void setDisplayText(final boolean displayText)
648   {
649     this._displayText = displayText;
650     this._has_displayText = true;
651   }
652
653   /**
654    * Sets the value of field 'end'.
655    * 
656    * @param end
657    *          the value of field 'end'.
658    */
659   public void setEnd(final int end)
660   {
661     this._end = end;
662     this._has_end = true;
663   }
664
665   /**
666    * Sets the value of field 'name'.
667    * 
668    * @param name
669    *          the value of field 'name'.
670    */
671   public void setName(final java.lang.String name)
672   {
673     this._name = name;
674   }
675
676   /**
677    * Sets the value of field 'outlineColour'.
678    * 
679    * @param outlineColour
680    *          the value of field 'outlineColour'.
681    */
682   public void setOutlineColour(final int outlineColour)
683   {
684     this._outlineColour = outlineColour;
685     this._has_outlineColour = true;
686   }
687
688   /**
689    * Sets the value of field 'pidThreshold'.
690    * 
691    * @param pidThreshold
692    *          the value of field 'pidThreshold'.
693    */
694   public void setPidThreshold(final int pidThreshold)
695   {
696     this._pidThreshold = pidThreshold;
697     this._has_pidThreshold = true;
698   }
699
700   /**
701    * 
702    * 
703    * @param index
704    * @param vSeq
705    * @throws java.lang.IndexOutOfBoundsException
706    *           if the index given is outside the bounds of the collection
707    */
708   public void setSeq(final int index, final int vSeq)
709           throws java.lang.IndexOutOfBoundsException
710   {
711     // check bounds for index
712     if (index < 0 || index >= this._seqList.size())
713     {
714       throw new IndexOutOfBoundsException("setSeq: Index value '" + index
715               + "' not in range [0.." + (this._seqList.size() - 1) + "]");
716     }
717
718     this._seqList.set(index, new java.lang.Integer(vSeq));
719   }
720
721   /**
722    * 
723    * 
724    * @param vSeqArray
725    */
726   public void setSeq(final int[] vSeqArray)
727   {
728     // -- copy array
729     _seqList.clear();
730
731     for (int i = 0; i < vSeqArray.length; i++)
732     {
733       this._seqList.add(new java.lang.Integer(vSeqArray[i]));
734     }
735   }
736
737   /**
738    * Sets the value of field 'start'.
739    * 
740    * @param start
741    *          the value of field 'start'.
742    */
743   public void setStart(final int start)
744   {
745     this._start = start;
746     this._has_start = true;
747   }
748
749   /**
750    * Method unmarshal.
751    * 
752    * @param reader
753    * @throws org.exolab.castor.xml.MarshalException
754    *           if object is null or if any SAXException is thrown during
755    *           marshaling
756    * @throws org.exolab.castor.xml.ValidationException
757    *           if this object is an invalid instance according to the schema
758    * @return the unmarshaled jalview.binding.JGroup
759    */
760   public static jalview.binding.JGroup unmarshal(
761           final java.io.Reader reader)
762           throws org.exolab.castor.xml.MarshalException,
763           org.exolab.castor.xml.ValidationException
764   {
765     return (jalview.binding.JGroup) Unmarshaller
766             .unmarshal(jalview.binding.JGroup.class, reader);
767   }
768
769   /**
770    * 
771    * 
772    * @throws org.exolab.castor.xml.ValidationException
773    *           if this object is an invalid instance according to the schema
774    */
775   public void validate() throws org.exolab.castor.xml.ValidationException
776   {
777     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
778     validator.validate(this);
779   }
780
781 }