d7deeffb2c64a5e694557e65fb838aa318054808
[jalview.git] / src / jalview / schemabinding / version2 / Feature.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 Feature.
38  * 
39  * @version $Revision$ $Date$
40  */
41 public class Feature implements java.io.Serializable
42 {
43
44   // --------------------------/
45   // - Class/Member Variables -/
46   // --------------------------/
47
48   /**
49    * Field _begin.
50    */
51   private int _begin;
52
53   /**
54    * keeps track of state for field: _begin
55    */
56   private boolean _has_begin;
57
58   /**
59    * Field _end.
60    */
61   private int _end;
62
63   /**
64    * keeps track of state for field: _end
65    */
66   private boolean _has_end;
67
68   /**
69    * Field _type.
70    */
71   private java.lang.String _type;
72
73   /**
74    * Field _description.
75    */
76   private java.lang.String _description;
77
78   /**
79    * Field _status.
80    */
81   private java.lang.String _status;
82
83   /**
84    * Field _featureGroup.
85    */
86   private java.lang.String _featureGroup;
87
88   /**
89    * Field _score.
90    */
91   private float _score;
92
93   /**
94    * keeps track of state for field: _score
95    */
96   private boolean _has_score;
97
98   /**
99    * Field _otherDataList.
100    */
101   private java.util.Vector _otherDataList;
102
103   // ----------------/
104   // - Constructors -/
105   // ----------------/
106
107   public Feature()
108   {
109     super();
110     this._otherDataList = new java.util.Vector();
111   }
112
113   // -----------/
114   // - Methods -/
115   // -----------/
116
117   /**
118    * 
119    * 
120    * @param vOtherData
121    * @throws java.lang.IndexOutOfBoundsException
122    *           if the index given is outside the bounds of the collection
123    */
124   public void addOtherData(
125           final jalview.schemabinding.version2.OtherData vOtherData)
126           throws java.lang.IndexOutOfBoundsException
127   {
128     this._otherDataList.addElement(vOtherData);
129   }
130
131   /**
132    * 
133    * 
134    * @param index
135    * @param vOtherData
136    * @throws java.lang.IndexOutOfBoundsException
137    *           if the index given is outside the bounds of the collection
138    */
139   public void addOtherData(final int index,
140           final jalview.schemabinding.version2.OtherData vOtherData)
141           throws java.lang.IndexOutOfBoundsException
142   {
143     this._otherDataList.add(index, vOtherData);
144   }
145
146   /**
147      */
148   public void deleteBegin()
149   {
150     this._has_begin = false;
151   }
152
153   /**
154      */
155   public void deleteEnd()
156   {
157     this._has_end = false;
158   }
159
160   /**
161      */
162   public void deleteScore()
163   {
164     this._has_score = false;
165   }
166
167   /**
168    * Method enumerateOtherData.
169    * 
170    * @return an Enumeration over all jalview.schemabinding.version2.OtherData
171    *         elements
172    */
173   public java.util.Enumeration enumerateOtherData()
174   {
175     return this._otherDataList.elements();
176   }
177
178   /**
179    * Returns the value of field 'begin'.
180    * 
181    * @return the value of field 'Begin'.
182    */
183   public int getBegin()
184   {
185     return this._begin;
186   }
187
188   /**
189    * Returns the value of field 'description'.
190    * 
191    * @return the value of field 'Description'.
192    */
193   public java.lang.String getDescription()
194   {
195     return this._description;
196   }
197
198   /**
199    * Returns the value of field 'end'.
200    * 
201    * @return the value of field 'End'.
202    */
203   public int getEnd()
204   {
205     return this._end;
206   }
207
208   /**
209    * Returns the value of field 'featureGroup'.
210    * 
211    * @return the value of field 'FeatureGroup'.
212    */
213   public java.lang.String getFeatureGroup()
214   {
215     return this._featureGroup;
216   }
217
218   /**
219    * Method getOtherData.
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.schemabinding.version2.OtherData at the
225    *         given index
226    */
227   public jalview.schemabinding.version2.OtherData getOtherData(
228           final int index) throws java.lang.IndexOutOfBoundsException
229   {
230     // check bounds for index
231     if (index < 0 || index >= this._otherDataList.size())
232     {
233       throw new IndexOutOfBoundsException("getOtherData: Index value '"
234               + index + "' not in range [0.."
235               + (this._otherDataList.size() - 1) + "]");
236     }
237
238     return (jalview.schemabinding.version2.OtherData) _otherDataList
239             .get(index);
240   }
241
242   /**
243    * Method getOtherData.Returns the contents of the collection in an Array.
244    * <p>
245    * Note: Just in case the collection contents are changing in another thread,
246    * we pass a 0-length Array of the correct type into the API call. This way we
247    * <i>know</i> that the Array returned is of exactly the correct length.
248    * 
249    * @return this collection as an Array
250    */
251   public jalview.schemabinding.version2.OtherData[] getOtherData()
252   {
253     jalview.schemabinding.version2.OtherData[] array = new jalview.schemabinding.version2.OtherData[0];
254     return (jalview.schemabinding.version2.OtherData[]) this._otherDataList
255             .toArray(array);
256   }
257
258   /**
259    * Method getOtherDataCount.
260    * 
261    * @return the size of this collection
262    */
263   public int getOtherDataCount()
264   {
265     return this._otherDataList.size();
266   }
267
268   /**
269    * Returns the value of field 'score'.
270    * 
271    * @return the value of field 'Score'.
272    */
273   public float getScore()
274   {
275     return this._score;
276   }
277
278   /**
279    * Returns the value of field 'status'.
280    * 
281    * @return the value of field 'Status'.
282    */
283   public java.lang.String getStatus()
284   {
285     return this._status;
286   }
287
288   /**
289    * Returns the value of field 'type'.
290    * 
291    * @return the value of field 'Type'.
292    */
293   public java.lang.String getType()
294   {
295     return this._type;
296   }
297
298   /**
299    * Method hasBegin.
300    * 
301    * @return true if at least one Begin has been added
302    */
303   public boolean hasBegin()
304   {
305     return this._has_begin;
306   }
307
308   /**
309    * Method hasEnd.
310    * 
311    * @return true if at least one End has been added
312    */
313   public boolean hasEnd()
314   {
315     return this._has_end;
316   }
317
318   /**
319    * Method hasScore.
320    * 
321    * @return true if at least one Score has been added
322    */
323   public boolean hasScore()
324   {
325     return this._has_score;
326   }
327
328   /**
329    * Method isValid.
330    * 
331    * @return true if this object is valid according to the schema
332    */
333   public boolean isValid()
334   {
335     try
336     {
337       validate();
338     } catch (org.exolab.castor.xml.ValidationException vex)
339     {
340       return false;
341     }
342     return true;
343   }
344
345   /**
346    * 
347    * 
348    * @param out
349    * @throws org.exolab.castor.xml.MarshalException
350    *           if object is null or if any SAXException is thrown during
351    *           marshaling
352    * @throws org.exolab.castor.xml.ValidationException
353    *           if this object is an invalid instance according to the schema
354    */
355   public void marshal(final java.io.Writer out)
356           throws org.exolab.castor.xml.MarshalException,
357           org.exolab.castor.xml.ValidationException
358   {
359     Marshaller.marshal(this, out);
360   }
361
362   /**
363    * 
364    * 
365    * @param handler
366    * @throws java.io.IOException
367    *           if an IOException occurs during marshaling
368    * @throws org.exolab.castor.xml.ValidationException
369    *           if this object is an invalid instance according to the schema
370    * @throws org.exolab.castor.xml.MarshalException
371    *           if object is null or if any SAXException is thrown during
372    *           marshaling
373    */
374   public void marshal(final org.xml.sax.ContentHandler handler)
375           throws java.io.IOException,
376           org.exolab.castor.xml.MarshalException,
377           org.exolab.castor.xml.ValidationException
378   {
379     Marshaller.marshal(this, handler);
380   }
381
382   /**
383      */
384   public void removeAllOtherData()
385   {
386     this._otherDataList.clear();
387   }
388
389   /**
390    * Method removeOtherData.
391    * 
392    * @param vOtherData
393    * @return true if the object was removed from the collection.
394    */
395   public boolean removeOtherData(
396           final jalview.schemabinding.version2.OtherData vOtherData)
397   {
398     boolean removed = _otherDataList.remove(vOtherData);
399     return removed;
400   }
401
402   /**
403    * Method removeOtherDataAt.
404    * 
405    * @param index
406    * @return the element removed from the collection
407    */
408   public jalview.schemabinding.version2.OtherData removeOtherDataAt(
409           final int index)
410   {
411     java.lang.Object obj = this._otherDataList.remove(index);
412     return (jalview.schemabinding.version2.OtherData) obj;
413   }
414
415   /**
416    * Sets the value of field 'begin'.
417    * 
418    * @param begin
419    *          the value of field 'begin'.
420    */
421   public void setBegin(final int begin)
422   {
423     this._begin = begin;
424     this._has_begin = true;
425   }
426
427   /**
428    * Sets the value of field 'description'.
429    * 
430    * @param description
431    *          the value of field 'description'.
432    */
433   public void setDescription(final java.lang.String description)
434   {
435     this._description = description;
436   }
437
438   /**
439    * Sets the value of field 'end'.
440    * 
441    * @param end
442    *          the value of field 'end'.
443    */
444   public void setEnd(final int end)
445   {
446     this._end = end;
447     this._has_end = true;
448   }
449
450   /**
451    * Sets the value of field 'featureGroup'.
452    * 
453    * @param featureGroup
454    *          the value of field 'featureGroup'.
455    */
456   public void setFeatureGroup(final java.lang.String featureGroup)
457   {
458     this._featureGroup = featureGroup;
459   }
460
461   /**
462    * 
463    * 
464    * @param index
465    * @param vOtherData
466    * @throws java.lang.IndexOutOfBoundsException
467    *           if the index given is outside the bounds of the collection
468    */
469   public void setOtherData(final int index,
470           final jalview.schemabinding.version2.OtherData vOtherData)
471           throws java.lang.IndexOutOfBoundsException
472   {
473     // check bounds for index
474     if (index < 0 || index >= this._otherDataList.size())
475     {
476       throw new IndexOutOfBoundsException("setOtherData: Index value '"
477               + index + "' not in range [0.."
478               + (this._otherDataList.size() - 1) + "]");
479     }
480
481     this._otherDataList.set(index, vOtherData);
482   }
483
484   /**
485    * 
486    * 
487    * @param vOtherDataArray
488    */
489   public void setOtherData(
490           final jalview.schemabinding.version2.OtherData[] vOtherDataArray)
491   {
492     // -- copy array
493     _otherDataList.clear();
494
495     for (int i = 0; i < vOtherDataArray.length; i++)
496     {
497       this._otherDataList.add(vOtherDataArray[i]);
498     }
499   }
500
501   /**
502    * Sets the value of field 'score'.
503    * 
504    * @param score
505    *          the value of field 'score'.
506    */
507   public void setScore(final float score)
508   {
509     this._score = score;
510     this._has_score = true;
511   }
512
513   /**
514    * Sets the value of field 'status'.
515    * 
516    * @param status
517    *          the value of field 'status'.
518    */
519   public void setStatus(final java.lang.String status)
520   {
521     this._status = status;
522   }
523
524   /**
525    * Sets the value of field 'type'.
526    * 
527    * @param type
528    *          the value of field 'type'.
529    */
530   public void setType(final java.lang.String type)
531   {
532     this._type = type;
533   }
534
535   /**
536    * Method unmarshal.
537    * 
538    * @param reader
539    * @throws org.exolab.castor.xml.MarshalException
540    *           if object is null or if any SAXException is thrown during
541    *           marshaling
542    * @throws org.exolab.castor.xml.ValidationException
543    *           if this object is an invalid instance according to the schema
544    * @return the unmarshaled jalview.schemabinding.version2.Featur
545    */
546   public static jalview.schemabinding.version2.Feature unmarshal(
547           final java.io.Reader reader)
548           throws org.exolab.castor.xml.MarshalException,
549           org.exolab.castor.xml.ValidationException
550   {
551     return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(
552             jalview.schemabinding.version2.Feature.class, reader);
553   }
554
555   /**
556    * 
557    * 
558    * @throws org.exolab.castor.xml.ValidationException
559    *           if this object is an invalid instance according to the schema
560    */
561   public void validate() throws org.exolab.castor.xml.ValidationException
562   {
563     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
564     validator.validate(this);
565   }
566
567 }