2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4.0.b2)
\r
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.schemabinding.version2;
\r
21 // ---------------------------------/
\r
22 // - Imported classes and packages -/
\r
23 // ---------------------------------/
\r
25 import org.exolab.castor.xml.Marshaller;
\r
26 import org.exolab.castor.xml.Unmarshaller;
\r
31 * @version $Revision$ $Date$
\r
33 public class Feature implements java.io.Serializable
\r
36 // --------------------------/
\r
37 // - Class/Member Variables -/
\r
38 // --------------------------/
\r
46 * keeps track of state for field: _begin
\r
48 private boolean _has_begin;
\r
56 * keeps track of state for field: _end
\r
58 private boolean _has_end;
\r
63 private java.lang.String _type;
\r
66 * Field _description.
\r
68 private java.lang.String _description;
\r
73 private java.lang.String _status;
\r
76 * Field _featureGroup.
\r
78 private java.lang.String _featureGroup;
\r
83 private float _score;
\r
86 * keeps track of state for field: _score
\r
88 private boolean _has_score;
\r
91 * Field _otherDataList.
\r
93 private java.util.Vector _otherDataList;
\r
95 // ----------------/
\r
96 // - Constructors -/
\r
97 // ----------------/
\r
102 this._otherDataList = new java.util.Vector();
\r
112 * @param vOtherData
\r
113 * @throws java.lang.IndexOutOfBoundsException
\r
114 * if the index given is outside the bounds of the collection
\r
116 public void addOtherData(
\r
117 final jalview.schemabinding.version2.OtherData vOtherData)
\r
118 throws java.lang.IndexOutOfBoundsException
\r
120 this._otherDataList.addElement(vOtherData);
\r
127 * @param vOtherData
\r
128 * @throws java.lang.IndexOutOfBoundsException
\r
129 * if the index given is outside the bounds of the collection
\r
131 public void addOtherData(final int index,
\r
132 final jalview.schemabinding.version2.OtherData vOtherData)
\r
133 throws java.lang.IndexOutOfBoundsException
\r
135 this._otherDataList.add(index, vOtherData);
\r
140 public void deleteBegin()
\r
142 this._has_begin = false;
\r
147 public void deleteEnd()
\r
149 this._has_end = false;
\r
154 public void deleteScore()
\r
156 this._has_score = false;
\r
160 * Method enumerateOtherData.
\r
162 * @return an Enumeration over all jalview.schemabinding.version2.OtherData
\r
165 public java.util.Enumeration enumerateOtherData()
\r
167 return this._otherDataList.elements();
\r
171 * Returns the value of field 'begin'.
\r
173 * @return the value of field 'Begin'.
\r
175 public int getBegin()
\r
177 return this._begin;
\r
181 * Returns the value of field 'description'.
\r
183 * @return the value of field 'Description'.
\r
185 public java.lang.String getDescription()
\r
187 return this._description;
\r
191 * Returns the value of field 'end'.
\r
193 * @return the value of field 'End'.
\r
195 public int getEnd()
\r
201 * Returns the value of field 'featureGroup'.
\r
203 * @return the value of field 'FeatureGroup'.
\r
205 public java.lang.String getFeatureGroup()
\r
207 return this._featureGroup;
\r
211 * Method getOtherData.
\r
214 * @throws java.lang.IndexOutOfBoundsException
\r
215 * if the index given is outside the bounds of the collection
\r
216 * @return the value of the jalview.schemabinding.version2.OtherData at the
\r
219 public jalview.schemabinding.version2.OtherData getOtherData(
\r
220 final int index) throws java.lang.IndexOutOfBoundsException
\r
222 // check bounds for index
\r
223 if (index < 0 || index >= this._otherDataList.size())
\r
225 throw new IndexOutOfBoundsException("getOtherData: Index value '"
\r
226 + index + "' not in range [0.."
\r
227 + (this._otherDataList.size() - 1) + "]");
\r
230 return (jalview.schemabinding.version2.OtherData) _otherDataList
\r
235 * Method getOtherData.Returns the contents of the collection in an Array.
\r
237 * Note: Just in case the collection contents are changing in another thread,
\r
238 * we pass a 0-length Array of the correct type into the API call. This way we
\r
239 * <i>know</i> that the Array returned is of exactly the correct length.
\r
241 * @return this collection as an Array
\r
243 public jalview.schemabinding.version2.OtherData[] getOtherData()
\r
245 jalview.schemabinding.version2.OtherData[] array = new jalview.schemabinding.version2.OtherData[0];
\r
246 return (jalview.schemabinding.version2.OtherData[]) this._otherDataList
\r
251 * Method getOtherDataCount.
\r
253 * @return the size of this collection
\r
255 public int getOtherDataCount()
\r
257 return this._otherDataList.size();
\r
261 * Returns the value of field 'score'.
\r
263 * @return the value of field 'Score'.
\r
265 public float getScore()
\r
267 return this._score;
\r
271 * Returns the value of field 'status'.
\r
273 * @return the value of field 'Status'.
\r
275 public java.lang.String getStatus()
\r
277 return this._status;
\r
281 * Returns the value of field 'type'.
\r
283 * @return the value of field 'Type'.
\r
285 public java.lang.String getType()
\r
293 * @return true if at least one Begin has been added
\r
295 public boolean hasBegin()
\r
297 return this._has_begin;
\r
303 * @return true if at least one End has been added
\r
305 public boolean hasEnd()
\r
307 return this._has_end;
\r
313 * @return true if at least one Score has been added
\r
315 public boolean hasScore()
\r
317 return this._has_score;
\r
323 * @return true if this object is valid according to the schema
\r
325 public boolean isValid()
\r
330 } catch (org.exolab.castor.xml.ValidationException vex)
\r
341 * @throws org.exolab.castor.xml.MarshalException
\r
342 * if object is null or if any SAXException is thrown during
\r
344 * @throws org.exolab.castor.xml.ValidationException
\r
345 * if this object is an invalid instance according to the
\r
348 public void marshal(final java.io.Writer out)
\r
349 throws org.exolab.castor.xml.MarshalException,
\r
350 org.exolab.castor.xml.ValidationException
\r
352 Marshaller.marshal(this, out);
\r
359 * @throws java.io.IOException
\r
360 * if an IOException occurs during marshaling
\r
361 * @throws org.exolab.castor.xml.ValidationException
\r
362 * if this object is an invalid instance according to the
\r
364 * @throws org.exolab.castor.xml.MarshalException
\r
365 * if object is null or if any SAXException is thrown during
\r
368 public void marshal(final org.xml.sax.ContentHandler handler)
\r
369 throws java.io.IOException,
\r
370 org.exolab.castor.xml.MarshalException,
\r
371 org.exolab.castor.xml.ValidationException
\r
373 Marshaller.marshal(this, handler);
\r
378 public void removeAllOtherData()
\r
380 this._otherDataList.clear();
\r
384 * Method removeOtherData.
\r
386 * @param vOtherData
\r
387 * @return true if the object was removed from the collection.
\r
389 public boolean removeOtherData(
\r
390 final jalview.schemabinding.version2.OtherData vOtherData)
\r
392 boolean removed = _otherDataList.remove(vOtherData);
\r
397 * Method removeOtherDataAt.
\r
400 * @return the element removed from the collection
\r
402 public jalview.schemabinding.version2.OtherData removeOtherDataAt(
\r
405 java.lang.Object obj = this._otherDataList.remove(index);
\r
406 return (jalview.schemabinding.version2.OtherData) obj;
\r
410 * Sets the value of field 'begin'.
\r
413 * the value of field 'begin'.
\r
415 public void setBegin(final int begin)
\r
417 this._begin = begin;
\r
418 this._has_begin = true;
\r
422 * Sets the value of field 'description'.
\r
424 * @param description
\r
425 * the value of field 'description'.
\r
427 public void setDescription(final java.lang.String description)
\r
429 this._description = description;
\r
433 * Sets the value of field 'end'.
\r
436 * the value of field 'end'.
\r
438 public void setEnd(final int end)
\r
441 this._has_end = true;
\r
445 * Sets the value of field 'featureGroup'.
\r
447 * @param featureGroup
\r
448 * the value of field 'featureGroup'.
\r
450 public void setFeatureGroup(final java.lang.String featureGroup)
\r
452 this._featureGroup = featureGroup;
\r
459 * @param vOtherData
\r
460 * @throws java.lang.IndexOutOfBoundsException
\r
461 * if the index given is outside the bounds of the collection
\r
463 public void setOtherData(final int index,
\r
464 final jalview.schemabinding.version2.OtherData vOtherData)
\r
465 throws java.lang.IndexOutOfBoundsException
\r
467 // check bounds for index
\r
468 if (index < 0 || index >= this._otherDataList.size())
\r
470 throw new IndexOutOfBoundsException("setOtherData: Index value '"
\r
471 + index + "' not in range [0.."
\r
472 + (this._otherDataList.size() - 1) + "]");
\r
475 this._otherDataList.set(index, vOtherData);
\r
481 * @param vOtherDataArray
\r
483 public void setOtherData(
\r
484 final jalview.schemabinding.version2.OtherData[] vOtherDataArray)
\r
487 _otherDataList.clear();
\r
489 for (int i = 0; i < vOtherDataArray.length; i++)
\r
491 this._otherDataList.add(vOtherDataArray[i]);
\r
496 * Sets the value of field 'score'.
\r
499 * the value of field 'score'.
\r
501 public void setScore(final float score)
\r
503 this._score = score;
\r
504 this._has_score = true;
\r
508 * Sets the value of field 'status'.
\r
511 * the value of field 'status'.
\r
513 public void setStatus(final java.lang.String status)
\r
515 this._status = status;
\r
519 * Sets the value of field 'type'.
\r
522 * the value of field 'type'.
\r
524 public void setType(final java.lang.String type)
\r
530 * Method unmarshal.
\r
533 * @throws org.exolab.castor.xml.MarshalException
\r
534 * if object is null or if any SAXException is thrown during
\r
536 * @throws org.exolab.castor.xml.ValidationException
\r
537 * if this object is an invalid instance according to the
\r
539 * @return the unmarshaled jalview.schemabinding.version2.Featur
\r
541 public static jalview.schemabinding.version2.Feature unmarshal(
\r
542 final java.io.Reader reader)
\r
543 throws org.exolab.castor.xml.MarshalException,
\r
544 org.exolab.castor.xml.ValidationException
\r
546 return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(
\r
547 jalview.schemabinding.version2.Feature.class, reader);
\r
553 * @throws org.exolab.castor.xml.ValidationException
\r
554 * if this object is an invalid instance according to the
\r
557 public void validate() throws org.exolab.castor.xml.ValidationException
\r
559 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
560 validator.validate(this);
\r