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