2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10 * of the License, or (at your option) any later version.
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.
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.
21 package jalview.schemabinding.version2;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
33 * @version $Revision$ $Date$
35 public class Feature implements java.io.Serializable
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
48 * keeps track of state for field: _begin
50 private boolean _has_begin;
58 * keeps track of state for field: _end
60 private boolean _has_end;
65 private java.lang.String _type;
70 private java.lang.String _description;
75 private java.lang.String _status;
78 * Field _featureGroup.
80 private java.lang.String _featureGroup;
88 * keeps track of state for field: _score
90 private boolean _has_score;
93 * Field _otherDataList.
95 private java.util.Vector _otherDataList;
104 this._otherDataList = new java.util.Vector();
115 * @throws java.lang.IndexOutOfBoundsException
116 * if the index given is outside the bounds of the collection
118 public void addOtherData(
119 final jalview.schemabinding.version2.OtherData vOtherData)
120 throws java.lang.IndexOutOfBoundsException
122 this._otherDataList.addElement(vOtherData);
130 * @throws java.lang.IndexOutOfBoundsException
131 * if the index given is outside the bounds of the collection
133 public void addOtherData(final int index,
134 final jalview.schemabinding.version2.OtherData vOtherData)
135 throws java.lang.IndexOutOfBoundsException
137 this._otherDataList.add(index, vOtherData);
142 public void deleteBegin()
144 this._has_begin = false;
149 public void deleteEnd()
151 this._has_end = false;
156 public void deleteScore()
158 this._has_score = false;
162 * Method enumerateOtherData.
164 * @return an Enumeration over all jalview.schemabinding.version2.OtherData
167 public java.util.Enumeration enumerateOtherData()
169 return this._otherDataList.elements();
173 * Returns the value of field 'begin'.
175 * @return the value of field 'Begin'.
177 public int getBegin()
183 * Returns the value of field 'description'.
185 * @return the value of field 'Description'.
187 public java.lang.String getDescription()
189 return this._description;
193 * Returns the value of field 'end'.
195 * @return the value of field 'End'.
203 * Returns the value of field 'featureGroup'.
205 * @return the value of field 'FeatureGroup'.
207 public java.lang.String getFeatureGroup()
209 return this._featureGroup;
213 * Method getOtherData.
216 * @throws java.lang.IndexOutOfBoundsException
217 * if the index given is outside the bounds of the collection
218 * @return the value of the jalview.schemabinding.version2.OtherData at the
221 public jalview.schemabinding.version2.OtherData getOtherData(
222 final int index) throws java.lang.IndexOutOfBoundsException
224 // check bounds for index
225 if (index < 0 || index >= this._otherDataList.size())
227 throw new IndexOutOfBoundsException("getOtherData: Index value '"
228 + index + "' not in range [0.."
229 + (this._otherDataList.size() - 1) + "]");
232 return (jalview.schemabinding.version2.OtherData) _otherDataList
237 * Method getOtherData.Returns the contents of the collection in an Array.
239 * Note: Just in case the collection contents are changing in another thread,
240 * we pass a 0-length Array of the correct type into the API call. This way we
241 * <i>know</i> 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
253 * Method getOtherDataCount.
255 * @return the size of this collection
257 public int getOtherDataCount()
259 return this._otherDataList.size();
263 * Returns the value of field 'score'.
265 * @return the value of field 'Score'.
267 public float getScore()
273 * Returns the value of field 'status'.
275 * @return the value of field 'Status'.
277 public java.lang.String getStatus()
283 * Returns the value of field 'type'.
285 * @return the value of field 'Type'.
287 public java.lang.String getType()
295 * @return true if at least one Begin has been added
297 public boolean hasBegin()
299 return this._has_begin;
305 * @return true if at least one End has been added
307 public boolean hasEnd()
309 return this._has_end;
315 * @return true if at least one Score has been added
317 public boolean hasScore()
319 return this._has_score;
325 * @return true if this object is valid according to the schema
327 public boolean isValid()
332 } catch (org.exolab.castor.xml.ValidationException vex)
343 * @throws org.exolab.castor.xml.MarshalException
344 * if object is null or if any SAXException is thrown during
346 * @throws org.exolab.castor.xml.ValidationException
347 * if this object is an invalid instance according to the schema
349 public void marshal(final java.io.Writer out)
350 throws org.exolab.castor.xml.MarshalException,
351 org.exolab.castor.xml.ValidationException
353 Marshaller.marshal(this, out);
360 * @throws java.io.IOException
361 * if an IOException occurs during marshaling
362 * @throws org.exolab.castor.xml.ValidationException
363 * if this object is an invalid instance according to the schema
364 * @throws org.exolab.castor.xml.MarshalException
365 * if object is null or if any SAXException is thrown during
368 public void marshal(final org.xml.sax.ContentHandler handler)
369 throws java.io.IOException,
370 org.exolab.castor.xml.MarshalException,
371 org.exolab.castor.xml.ValidationException
373 Marshaller.marshal(this, handler);
378 public void removeAllOtherData()
380 this._otherDataList.clear();
384 * Method removeOtherData.
387 * @return true if the object was removed from the collection.
389 public boolean removeOtherData(
390 final jalview.schemabinding.version2.OtherData vOtherData)
392 boolean removed = _otherDataList.remove(vOtherData);
397 * Method removeOtherDataAt.
400 * @return the element removed from the collection
402 public jalview.schemabinding.version2.OtherData removeOtherDataAt(
405 java.lang.Object obj = this._otherDataList.remove(index);
406 return (jalview.schemabinding.version2.OtherData) obj;
410 * Sets the value of field 'begin'.
413 * the value of field 'begin'.
415 public void setBegin(final int begin)
418 this._has_begin = true;
422 * Sets the value of field 'description'.
425 * the value of field 'description'.
427 public void setDescription(final java.lang.String description)
429 this._description = description;
433 * Sets the value of field 'end'.
436 * the value of field 'end'.
438 public void setEnd(final int end)
441 this._has_end = true;
445 * Sets the value of field 'featureGroup'.
447 * @param featureGroup
448 * the value of field 'featureGroup'.
450 public void setFeatureGroup(final java.lang.String featureGroup)
452 this._featureGroup = featureGroup;
460 * @throws java.lang.IndexOutOfBoundsException
461 * if the index given is outside the bounds of the collection
463 public void setOtherData(final int index,
464 final jalview.schemabinding.version2.OtherData vOtherData)
465 throws java.lang.IndexOutOfBoundsException
467 // check bounds for index
468 if (index < 0 || index >= this._otherDataList.size())
470 throw new IndexOutOfBoundsException("setOtherData: Index value '"
471 + index + "' not in range [0.."
472 + (this._otherDataList.size() - 1) + "]");
475 this._otherDataList.set(index, vOtherData);
481 * @param vOtherDataArray
483 public void setOtherData(
484 final jalview.schemabinding.version2.OtherData[] vOtherDataArray)
487 _otherDataList.clear();
489 for (int i = 0; i < vOtherDataArray.length; i++)
491 this._otherDataList.add(vOtherDataArray[i]);
496 * Sets the value of field 'score'.
499 * the value of field 'score'.
501 public void setScore(final float score)
504 this._has_score = true;
508 * Sets the value of field 'status'.
511 * the value of field 'status'.
513 public void setStatus(final java.lang.String status)
515 this._status = status;
519 * Sets the value of field 'type'.
522 * the value of field 'type'.
524 public void setType(final java.lang.String type)
533 * @throws org.exolab.castor.xml.MarshalException
534 * if object is null or if any SAXException is thrown during
536 * @throws org.exolab.castor.xml.ValidationException
537 * if this object is an invalid instance according to the schema
538 * @return the unmarshaled jalview.schemabinding.version2.Featur
540 public static jalview.schemabinding.version2.Feature unmarshal(
541 final java.io.Reader reader)
542 throws org.exolab.castor.xml.MarshalException,
543 org.exolab.castor.xml.ValidationException
545 return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(
546 jalview.schemabinding.version2.Feature.class, reader);
552 * @throws org.exolab.castor.xml.ValidationException
553 * if this object is an invalid instance according to the schema
555 public void validate() throws org.exolab.castor.xml.ValidationException
557 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
558 validator.validate(this);