2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
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 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemabinding.version2;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
31 * @version $Revision$ $Date$
33 public class Feature implements java.io.Serializable
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
46 * keeps track of state for field: _begin
48 private boolean _has_begin;
56 * keeps track of state for field: _end
58 private boolean _has_end;
63 private java.lang.String _type;
68 private java.lang.String _description;
73 private java.lang.String _status;
76 * Field _featureGroup.
78 private java.lang.String _featureGroup;
86 * keeps track of state for field: _score
88 private boolean _has_score;
91 * Field _otherDataList.
93 private java.util.Vector _otherDataList;
102 this._otherDataList = new java.util.Vector();
113 * @throws java.lang.IndexOutOfBoundsException
114 * if the index given is outside the bounds of the collection
116 public void addOtherData(
117 final jalview.schemabinding.version2.OtherData vOtherData)
118 throws java.lang.IndexOutOfBoundsException
120 this._otherDataList.addElement(vOtherData);
128 * @throws java.lang.IndexOutOfBoundsException
129 * if the index given is outside the bounds of the collection
131 public void addOtherData(final int index,
132 final jalview.schemabinding.version2.OtherData vOtherData)
133 throws java.lang.IndexOutOfBoundsException
135 this._otherDataList.add(index, vOtherData);
140 public void deleteBegin()
142 this._has_begin = false;
147 public void deleteEnd()
149 this._has_end = false;
154 public void deleteScore()
156 this._has_score = false;
160 * Method enumerateOtherData.
162 * @return an Enumeration over all jalview.schemabinding.version2.OtherData
165 public java.util.Enumeration enumerateOtherData()
167 return this._otherDataList.elements();
171 * Returns the value of field 'begin'.
173 * @return the value of field 'Begin'.
175 public int getBegin()
181 * Returns the value of field 'description'.
183 * @return the value of field 'Description'.
185 public java.lang.String getDescription()
187 return this._description;
191 * Returns the value of field 'end'.
193 * @return the value of field 'End'.
201 * Returns the value of field 'featureGroup'.
203 * @return the value of field 'FeatureGroup'.
205 public java.lang.String getFeatureGroup()
207 return this._featureGroup;
211 * Method getOtherData.
214 * @throws java.lang.IndexOutOfBoundsException
215 * if the index given is outside the bounds of the collection
216 * @return the value of the jalview.schemabinding.version2.OtherData at the
219 public jalview.schemabinding.version2.OtherData getOtherData(
220 final int index) throws java.lang.IndexOutOfBoundsException
222 // check bounds for index
223 if (index < 0 || index >= this._otherDataList.size())
225 throw new IndexOutOfBoundsException("getOtherData: Index value '"
226 + index + "' not in range [0.."
227 + (this._otherDataList.size() - 1) + "]");
230 return (jalview.schemabinding.version2.OtherData) _otherDataList
235 * Method getOtherData.Returns the contents of the collection in an Array.
237 * Note: Just in case the collection contents are changing in another thread,
238 * we pass a 0-length Array of the correct type into the API call. This way we
239 * <i>know</i> that the Array returned is of exactly the correct length.
241 * @return this collection as an Array
243 public jalview.schemabinding.version2.OtherData[] getOtherData()
245 jalview.schemabinding.version2.OtherData[] array = new jalview.schemabinding.version2.OtherData[0];
246 return (jalview.schemabinding.version2.OtherData[]) this._otherDataList
251 * Method getOtherDataCount.
253 * @return the size of this collection
255 public int getOtherDataCount()
257 return this._otherDataList.size();
261 * Returns the value of field 'score'.
263 * @return the value of field 'Score'.
265 public float getScore()
271 * Returns the value of field 'status'.
273 * @return the value of field 'Status'.
275 public java.lang.String getStatus()
281 * Returns the value of field 'type'.
283 * @return the value of field 'Type'.
285 public java.lang.String getType()
293 * @return true if at least one Begin has been added
295 public boolean hasBegin()
297 return this._has_begin;
303 * @return true if at least one End has been added
305 public boolean hasEnd()
307 return this._has_end;
313 * @return true if at least one Score has been added
315 public boolean hasScore()
317 return this._has_score;
323 * @return true if this object is valid according to the schema
325 public boolean isValid()
330 } catch (org.exolab.castor.xml.ValidationException vex)
341 * @throws org.exolab.castor.xml.MarshalException
342 * if object is null or if any SAXException is thrown during
344 * @throws org.exolab.castor.xml.ValidationException
345 * if this object is an invalid instance according to the schema
347 public void marshal(final java.io.Writer out)
348 throws org.exolab.castor.xml.MarshalException,
349 org.exolab.castor.xml.ValidationException
351 Marshaller.marshal(this, out);
358 * @throws java.io.IOException
359 * if an IOException occurs during marshaling
360 * @throws org.exolab.castor.xml.ValidationException
361 * if this object is an invalid instance according to the schema
362 * @throws org.exolab.castor.xml.MarshalException
363 * if object is null or if any SAXException is thrown during
366 public void marshal(final org.xml.sax.ContentHandler handler)
367 throws java.io.IOException,
368 org.exolab.castor.xml.MarshalException,
369 org.exolab.castor.xml.ValidationException
371 Marshaller.marshal(this, handler);
376 public void removeAllOtherData()
378 this._otherDataList.clear();
382 * Method removeOtherData.
385 * @return true if the object was removed from the collection.
387 public boolean removeOtherData(
388 final jalview.schemabinding.version2.OtherData vOtherData)
390 boolean removed = _otherDataList.remove(vOtherData);
395 * Method removeOtherDataAt.
398 * @return the element removed from the collection
400 public jalview.schemabinding.version2.OtherData removeOtherDataAt(
403 java.lang.Object obj = this._otherDataList.remove(index);
404 return (jalview.schemabinding.version2.OtherData) obj;
408 * Sets the value of field 'begin'.
411 * the value of field 'begin'.
413 public void setBegin(final int begin)
416 this._has_begin = true;
420 * Sets the value of field 'description'.
423 * the value of field 'description'.
425 public void setDescription(final java.lang.String description)
427 this._description = description;
431 * Sets the value of field 'end'.
434 * the value of field 'end'.
436 public void setEnd(final int end)
439 this._has_end = true;
443 * Sets the value of field 'featureGroup'.
445 * @param featureGroup
446 * the value of field 'featureGroup'.
448 public void setFeatureGroup(final java.lang.String featureGroup)
450 this._featureGroup = featureGroup;
458 * @throws java.lang.IndexOutOfBoundsException
459 * if the index given is outside the bounds of the collection
461 public void setOtherData(final int index,
462 final jalview.schemabinding.version2.OtherData vOtherData)
463 throws java.lang.IndexOutOfBoundsException
465 // check bounds for index
466 if (index < 0 || index >= this._otherDataList.size())
468 throw new IndexOutOfBoundsException("setOtherData: Index value '"
469 + index + "' not in range [0.."
470 + (this._otherDataList.size() - 1) + "]");
473 this._otherDataList.set(index, vOtherData);
479 * @param vOtherDataArray
481 public void setOtherData(
482 final jalview.schemabinding.version2.OtherData[] vOtherDataArray)
485 _otherDataList.clear();
487 for (int i = 0; i < vOtherDataArray.length; i++)
489 this._otherDataList.add(vOtherDataArray[i]);
494 * Sets the value of field 'score'.
497 * the value of field 'score'.
499 public void setScore(final float score)
502 this._has_score = true;
506 * Sets the value of field 'status'.
509 * the value of field 'status'.
511 public void setStatus(final java.lang.String status)
513 this._status = status;
517 * Sets the value of field 'type'.
520 * the value of field 'type'.
522 public void setType(final java.lang.String type)
531 * @throws org.exolab.castor.xml.MarshalException
532 * if object is null or if any SAXException is thrown during
534 * @throws org.exolab.castor.xml.ValidationException
535 * if this object is an invalid instance according to the schema
536 * @return the unmarshaled jalview.schemabinding.version2.Featur
538 public static jalview.schemabinding.version2.Feature unmarshal(
539 final java.io.Reader reader)
540 throws org.exolab.castor.xml.MarshalException,
541 org.exolab.castor.xml.ValidationException
543 return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(
544 jalview.schemabinding.version2.Feature.class, reader);
550 * @throws org.exolab.castor.xml.ValidationException
551 * if this object is an invalid instance according to the schema
553 public void validate() throws org.exolab.castor.xml.ValidationException
555 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
556 validator.validate(this);