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