2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
\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
102 this._otherDataList = new java.util.Vector();
\r
113 * @param vOtherData
\r
114 * @throws java.lang.IndexOutOfBoundsException if the index
\r
115 * given is outside the bounds of the collection
\r
117 public void addOtherData(
\r
118 final jalview.schemabinding.version2.OtherData vOtherData)
\r
119 throws java.lang.IndexOutOfBoundsException {
\r
120 this._otherDataList.addElement(vOtherData);
\r
127 * @param vOtherData
\r
128 * @throws java.lang.IndexOutOfBoundsException if the index
\r
129 * given is outside the bounds of the collection
\r
131 public void addOtherData(
\r
133 final jalview.schemabinding.version2.OtherData vOtherData)
\r
134 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
\r
163 * jalview.schemabinding.version2.OtherData elements
\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
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 if the index
\r
215 * given is outside the bounds of the collection
\r
216 * @return the value of the
\r
217 * jalview.schemabinding.version2.OtherData at the given index
\r
219 public jalview.schemabinding.version2.OtherData getOtherData(
\r
221 throws java.lang.IndexOutOfBoundsException {
\r
222 // check bounds for index
\r
223 if (index < 0 || index >= this._otherDataList.size()) {
\r
224 throw new IndexOutOfBoundsException("getOtherData: Index value '" + index + "' not in range [0.." + (this._otherDataList.size() - 1) + "]");
\r
227 return (jalview.schemabinding.version2.OtherData) _otherDataList.get(index);
\r
231 * Method getOtherData.Returns the contents of the collection
\r
232 * in an Array. <p>Note: Just in case the collection contents
\r
233 * are changing in another thread, we pass a 0-length Array of
\r
234 * the correct type into the API call. This way we <i>know</i>
\r
235 * that the Array returned is of exactly the correct length.
\r
237 * @return this collection as an Array
\r
239 public jalview.schemabinding.version2.OtherData[] getOtherData(
\r
241 jalview.schemabinding.version2.OtherData[] array = new jalview.schemabinding.version2.OtherData[0];
\r
242 return (jalview.schemabinding.version2.OtherData[]) this._otherDataList.toArray(array);
\r
246 * Method getOtherDataCount.
\r
248 * @return the size of this collection
\r
250 public int getOtherDataCount(
\r
252 return this._otherDataList.size();
\r
256 * Returns the value of field 'score'.
\r
258 * @return the value of field 'Score'.
\r
260 public float getScore(
\r
262 return this._score;
\r
266 * Returns the value of field 'status'.
\r
268 * @return the value of field 'Status'.
\r
270 public java.lang.String getStatus(
\r
272 return this._status;
\r
276 * Returns the value of field 'type'.
\r
278 * @return the value of field 'Type'.
\r
280 public java.lang.String getType(
\r
288 * @return true if at least one Begin has been added
\r
290 public boolean hasBegin(
\r
292 return this._has_begin;
\r
298 * @return true if at least one End has been added
\r
300 public boolean hasEnd(
\r
302 return this._has_end;
\r
308 * @return true if at least one Score has been added
\r
310 public boolean hasScore(
\r
312 return this._has_score;
\r
318 * @return true if this object is valid according to the schema
\r
320 public boolean isValid(
\r
324 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
334 * @throws org.exolab.castor.xml.MarshalException if object is
\r
335 * null or if any SAXException is thrown during marshaling
\r
336 * @throws org.exolab.castor.xml.ValidationException if this
\r
337 * object is an invalid instance according to the schema
\r
339 public void marshal(
\r
340 final java.io.Writer out)
\r
341 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
342 Marshaller.marshal(this, out);
\r
349 * @throws java.io.IOException if an IOException occurs during
\r
351 * @throws org.exolab.castor.xml.ValidationException if this
\r
352 * object is an invalid instance according to the schema
\r
353 * @throws org.exolab.castor.xml.MarshalException if object is
\r
354 * null or if any SAXException is thrown during marshaling
\r
356 public void marshal(
\r
357 final org.xml.sax.ContentHandler handler)
\r
358 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
359 Marshaller.marshal(this, handler);
\r
364 public void removeAllOtherData(
\r
366 this._otherDataList.clear();
\r
370 * Method removeOtherData.
\r
372 * @param vOtherData
\r
373 * @return true if the object was removed from the collection.
\r
375 public boolean removeOtherData(
\r
376 final jalview.schemabinding.version2.OtherData vOtherData) {
\r
377 boolean removed = _otherDataList.remove(vOtherData);
\r
382 * Method removeOtherDataAt.
\r
385 * @return the element removed from the collection
\r
387 public jalview.schemabinding.version2.OtherData removeOtherDataAt(
\r
389 java.lang.Object obj = this._otherDataList.remove(index);
\r
390 return (jalview.schemabinding.version2.OtherData) obj;
\r
394 * Sets the value of field 'begin'.
\r
396 * @param begin the value of field 'begin'.
\r
398 public void setBegin(
\r
400 this._begin = begin;
\r
401 this._has_begin = true;
\r
405 * Sets the value of field 'description'.
\r
407 * @param description the value of field 'description'.
\r
409 public void setDescription(
\r
410 final java.lang.String description) {
\r
411 this._description = description;
\r
415 * Sets the value of field 'end'.
\r
417 * @param end the value of field 'end'.
\r
419 public void setEnd(
\r
422 this._has_end = true;
\r
426 * Sets the value of field 'featureGroup'.
\r
428 * @param featureGroup the value of field 'featureGroup'.
\r
430 public void setFeatureGroup(
\r
431 final java.lang.String featureGroup) {
\r
432 this._featureGroup = featureGroup;
\r
439 * @param vOtherData
\r
440 * @throws java.lang.IndexOutOfBoundsException if the index
\r
441 * given is outside the bounds of the collection
\r
443 public void setOtherData(
\r
445 final jalview.schemabinding.version2.OtherData vOtherData)
\r
446 throws java.lang.IndexOutOfBoundsException {
\r
447 // check bounds for index
\r
448 if (index < 0 || index >= this._otherDataList.size()) {
\r
449 throw new IndexOutOfBoundsException("setOtherData: Index value '" + index + "' not in range [0.." + (this._otherDataList.size() - 1) + "]");
\r
452 this._otherDataList.set(index, vOtherData);
\r
458 * @param vOtherDataArray
\r
460 public void setOtherData(
\r
461 final jalview.schemabinding.version2.OtherData[] vOtherDataArray) {
\r
463 _otherDataList.clear();
\r
465 for (int i = 0; i < vOtherDataArray.length; i++) {
\r
466 this._otherDataList.add(vOtherDataArray[i]);
\r
471 * Sets the value of field 'score'.
\r
473 * @param score the value of field 'score'.
\r
475 public void setScore(
\r
476 final float score) {
\r
477 this._score = score;
\r
478 this._has_score = true;
\r
482 * Sets the value of field 'status'.
\r
484 * @param status the value of field 'status'.
\r
486 public void setStatus(
\r
487 final java.lang.String status) {
\r
488 this._status = status;
\r
492 * Sets the value of field 'type'.
\r
494 * @param type the value of field 'type'.
\r
496 public void setType(
\r
497 final java.lang.String type) {
\r
502 * Method unmarshal.
\r
505 * @throws org.exolab.castor.xml.MarshalException if object is
\r
506 * null or if any SAXException is thrown during marshaling
\r
507 * @throws org.exolab.castor.xml.ValidationException if this
\r
508 * object is an invalid instance according to the schema
\r
509 * @return the unmarshaled jalview.schemabinding.version2.Featur
\r
511 public static jalview.schemabinding.version2.Feature unmarshal(
\r
512 final java.io.Reader reader)
\r
513 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
514 return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(jalview.schemabinding.version2.Feature.class, reader);
\r
520 * @throws org.exolab.castor.xml.ValidationException if this
\r
521 * object is an invalid instance according to the schema
\r
523 public void validate(
\r
525 throws org.exolab.castor.xml.ValidationException {
\r
526 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
527 validator.validate(this);
\r