1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
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.
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.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
17 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import org.exolab.castor.xml.Marshaller;
32 import org.exolab.castor.xml.Unmarshaller;
37 * @version $Revision$ $Date$
39 public class Feature implements java.io.Serializable {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
52 * keeps track of state for field: _begin
54 private boolean _has_begin;
62 * keeps track of state for field: _end
64 private boolean _has_end;
69 private java.lang.String _type;
74 private java.lang.String _description;
79 private java.lang.String _status;
82 * Field _featureGroup.
84 private java.lang.String _featureGroup;
92 * keeps track of state for field: _score
94 private boolean _has_score;
97 * Field _otherDataList.
99 private java.util.Vector _otherDataList;
108 this._otherDataList = new java.util.Vector();
120 * @throws java.lang.IndexOutOfBoundsException if the index
121 * given is outside the bounds of the collection
123 public void addOtherData(
124 final jalview.schemabinding.version2.OtherData vOtherData)
125 throws java.lang.IndexOutOfBoundsException {
126 this._otherDataList.addElement(vOtherData);
134 * @throws java.lang.IndexOutOfBoundsException if the index
135 * given is outside the bounds of the collection
137 public void addOtherData(
139 final jalview.schemabinding.version2.OtherData vOtherData)
140 throws java.lang.IndexOutOfBoundsException {
141 this._otherDataList.add(index, vOtherData);
146 public void deleteBegin(
148 this._has_begin= false;
153 public void deleteEnd(
155 this._has_end= false;
160 public void deleteScore(
162 this._has_score= false;
166 * Method enumerateOtherData.
168 * @return an Enumeration over all
169 * jalview.schemabinding.version2.OtherData elements
171 public java.util.Enumeration enumerateOtherData(
173 return this._otherDataList.elements();
177 * Returns the value of field 'begin'.
179 * @return the value of field 'Begin'.
187 * Returns the value of field 'description'.
189 * @return the value of field 'Description'.
191 public java.lang.String getDescription(
193 return this._description;
197 * Returns the value of field 'end'.
199 * @return the value of field 'End'.
207 * Returns the value of field 'featureGroup'.
209 * @return the value of field 'FeatureGroup'.
211 public java.lang.String getFeatureGroup(
213 return this._featureGroup;
217 * Method getOtherData.
220 * @throws java.lang.IndexOutOfBoundsException if the index
221 * given is outside the bounds of the collection
222 * @return the value of the
223 * jalview.schemabinding.version2.OtherData at the given index
225 public jalview.schemabinding.version2.OtherData getOtherData(
227 throws java.lang.IndexOutOfBoundsException {
228 // check bounds for index
229 if (index < 0 || index >= this._otherDataList.size()) {
230 throw new IndexOutOfBoundsException("getOtherData: Index value '" + index + "' not in range [0.." + (this._otherDataList.size() - 1) + "]");
233 return (jalview.schemabinding.version2.OtherData) _otherDataList.get(index);
237 * Method getOtherData.Returns the contents of the collection
238 * in an Array. <p>Note: Just in case the collection contents
239 * are changing in another thread, we pass a 0-length Array of
240 * the correct type into the API call. This way we <i>know</i>
241 * that the Array returned is of exactly the correct length.
243 * @return this collection as an Array
245 public jalview.schemabinding.version2.OtherData[] getOtherData(
247 jalview.schemabinding.version2.OtherData[] array = new jalview.schemabinding.version2.OtherData[0];
248 return (jalview.schemabinding.version2.OtherData[]) this._otherDataList.toArray(array);
252 * Method getOtherDataCount.
254 * @return the size of this collection
256 public int getOtherDataCount(
258 return this._otherDataList.size();
262 * Returns the value of field 'score'.
264 * @return the value of field 'Score'.
266 public float getScore(
272 * Returns the value of field 'status'.
274 * @return the value of field 'Status'.
276 public java.lang.String getStatus(
282 * Returns the value of field 'type'.
284 * @return the value of field 'Type'.
286 public java.lang.String getType(
294 * @return true if at least one Begin has been added
296 public boolean hasBegin(
298 return this._has_begin;
304 * @return true if at least one End has been added
306 public boolean hasEnd(
308 return this._has_end;
314 * @return true if at least one Score has been added
316 public boolean hasScore(
318 return this._has_score;
324 * @return true if this object is valid according to the schema
326 public boolean isValid(
330 } catch (org.exolab.castor.xml.ValidationException vex) {
340 * @throws org.exolab.castor.xml.MarshalException if object is
341 * null or if any SAXException is thrown during marshaling
342 * @throws org.exolab.castor.xml.ValidationException if this
343 * object is an invalid instance according to the schema
346 final java.io.Writer out)
347 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
348 Marshaller.marshal(this, out);
355 * @throws java.io.IOException if an IOException occurs during
357 * @throws org.exolab.castor.xml.ValidationException if this
358 * object is an invalid instance according to the schema
359 * @throws org.exolab.castor.xml.MarshalException if object is
360 * null or if any SAXException is thrown during marshaling
363 final org.xml.sax.ContentHandler handler)
364 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
365 Marshaller.marshal(this, handler);
370 public void removeAllOtherData(
372 this._otherDataList.clear();
376 * Method removeOtherData.
379 * @return true if the object was removed from the collection.
381 public boolean removeOtherData(
382 final jalview.schemabinding.version2.OtherData vOtherData) {
383 boolean removed = _otherDataList.remove(vOtherData);
388 * Method removeOtherDataAt.
391 * @return the element removed from the collection
393 public jalview.schemabinding.version2.OtherData removeOtherDataAt(
395 java.lang.Object obj = this._otherDataList.remove(index);
396 return (jalview.schemabinding.version2.OtherData) obj;
400 * Sets the value of field 'begin'.
402 * @param begin the value of field 'begin'.
404 public void setBegin(
407 this._has_begin = true;
411 * Sets the value of field 'description'.
413 * @param description the value of field 'description'.
415 public void setDescription(
416 final java.lang.String description) {
417 this._description = description;
421 * Sets the value of field 'end'.
423 * @param end the value of field 'end'.
428 this._has_end = true;
432 * Sets the value of field 'featureGroup'.
434 * @param featureGroup the value of field 'featureGroup'.
436 public void setFeatureGroup(
437 final java.lang.String featureGroup) {
438 this._featureGroup = featureGroup;
446 * @throws java.lang.IndexOutOfBoundsException if the index
447 * given is outside the bounds of the collection
449 public void setOtherData(
451 final jalview.schemabinding.version2.OtherData vOtherData)
452 throws java.lang.IndexOutOfBoundsException {
453 // check bounds for index
454 if (index < 0 || index >= this._otherDataList.size()) {
455 throw new IndexOutOfBoundsException("setOtherData: Index value '" + index + "' not in range [0.." + (this._otherDataList.size() - 1) + "]");
458 this._otherDataList.set(index, vOtherData);
464 * @param vOtherDataArray
466 public void setOtherData(
467 final jalview.schemabinding.version2.OtherData[] vOtherDataArray) {
469 _otherDataList.clear();
471 for (int i = 0; i < vOtherDataArray.length; i++) {
472 this._otherDataList.add(vOtherDataArray[i]);
477 * Sets the value of field 'score'.
479 * @param score the value of field 'score'.
481 public void setScore(
484 this._has_score = true;
488 * Sets the value of field 'status'.
490 * @param status the value of field 'status'.
492 public void setStatus(
493 final java.lang.String status) {
494 this._status = status;
498 * Sets the value of field 'type'.
500 * @param type the value of field 'type'.
503 final java.lang.String type) {
511 * @throws org.exolab.castor.xml.MarshalException if object is
512 * null or if any SAXException is thrown during marshaling
513 * @throws org.exolab.castor.xml.ValidationException if this
514 * object is an invalid instance according to the schema
515 * @return the unmarshaled jalview.schemabinding.version2.Featur
517 public static jalview.schemabinding.version2.Feature unmarshal(
518 final java.io.Reader reader)
519 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
520 return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(jalview.schemabinding.version2.Feature.class, reader);
526 * @throws org.exolab.castor.xml.ValidationException if this
527 * object is an invalid instance according to the schema
529 public void validate(
531 throws org.exolab.castor.xml.ValidationException {
532 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
533 validator.validate(this);