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.binding;
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 JSeq implements java.io.Serializable {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
52 * keeps track of state for field: _colour
54 private boolean _has_colour;
62 * keeps track of state for field: _start
64 private boolean _has_start;
72 * keeps track of state for field: _end
74 private boolean _has_end;
82 * keeps track of state for field: _id
84 private boolean _has_id;
87 * Field _featuresList.
89 private java.util.Vector _featuresList;
94 private java.util.Vector _pdbidsList;
103 this._featuresList = new java.util.Vector();
104 this._pdbidsList = new java.util.Vector();
116 * @throws java.lang.IndexOutOfBoundsException if the index
117 * given is outside the bounds of the collection
119 public void addFeatures(
120 final jalview.binding.Features vFeatures)
121 throws java.lang.IndexOutOfBoundsException {
122 this._featuresList.addElement(vFeatures);
130 * @throws java.lang.IndexOutOfBoundsException if the index
131 * given is outside the bounds of the collection
133 public void addFeatures(
135 final jalview.binding.Features vFeatures)
136 throws java.lang.IndexOutOfBoundsException {
137 this._featuresList.add(index, vFeatures);
144 * @throws java.lang.IndexOutOfBoundsException if the index
145 * given is outside the bounds of the collection
147 public void addPdbids(
148 final jalview.binding.Pdbids vPdbids)
149 throws java.lang.IndexOutOfBoundsException {
150 this._pdbidsList.addElement(vPdbids);
158 * @throws java.lang.IndexOutOfBoundsException if the index
159 * given is outside the bounds of the collection
161 public void addPdbids(
163 final jalview.binding.Pdbids vPdbids)
164 throws java.lang.IndexOutOfBoundsException {
165 this._pdbidsList.add(index, vPdbids);
170 public void deleteColour(
172 this._has_colour= false;
177 public void deleteEnd(
179 this._has_end= false;
184 public void deleteId(
191 public void deleteStart(
193 this._has_start= false;
197 * Method enumerateFeatures.
199 * @return an Enumeration over all jalview.binding.Features
202 public java.util.Enumeration enumerateFeatures(
204 return this._featuresList.elements();
208 * Method enumeratePdbids.
210 * @return an Enumeration over all jalview.binding.Pdbids
213 public java.util.Enumeration enumeratePdbids(
215 return this._pdbidsList.elements();
219 * Returns the value of field 'colour'.
221 * @return the value of field 'Colour'.
223 public int getColour(
229 * Returns the value of field 'end'.
231 * @return the value of field 'End'.
239 * Method getFeatures.
242 * @throws java.lang.IndexOutOfBoundsException if the index
243 * given is outside the bounds of the collection
244 * @return the value of the jalview.binding.Features at the
247 public jalview.binding.Features getFeatures(
249 throws java.lang.IndexOutOfBoundsException {
250 // check bounds for index
251 if (index < 0 || index >= this._featuresList.size()) {
252 throw new IndexOutOfBoundsException("getFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
255 return (jalview.binding.Features) _featuresList.get(index);
259 * Method getFeatures.Returns the contents of the collection in
260 * an Array. <p>Note: Just in case the collection contents
261 * are changing in another thread, we pass a 0-length Array of
262 * the correct type into the API call. This way we <i>know</i>
263 * that the Array returned is of exactly the correct length.
265 * @return this collection as an Array
267 public jalview.binding.Features[] getFeatures(
269 jalview.binding.Features[] array = new jalview.binding.Features[0];
270 return (jalview.binding.Features[]) this._featuresList.toArray(array);
274 * Method getFeaturesCount.
276 * @return the size of this collection
278 public int getFeaturesCount(
280 return this._featuresList.size();
284 * Returns the value of field 'id'.
286 * @return the value of field 'Id'.
297 * @throws java.lang.IndexOutOfBoundsException if the index
298 * given is outside the bounds of the collection
299 * @return the value of the jalview.binding.Pdbids at the given
302 public jalview.binding.Pdbids getPdbids(
304 throws java.lang.IndexOutOfBoundsException {
305 // check bounds for index
306 if (index < 0 || index >= this._pdbidsList.size()) {
307 throw new IndexOutOfBoundsException("getPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
310 return (jalview.binding.Pdbids) _pdbidsList.get(index);
314 * Method getPdbids.Returns the contents of the collection in
315 * an Array. <p>Note: Just in case the collection contents
316 * are changing in another thread, we pass a 0-length Array of
317 * the correct type into the API call. This way we <i>know</i>
318 * that the Array returned is of exactly the correct length.
320 * @return this collection as an Array
322 public jalview.binding.Pdbids[] getPdbids(
324 jalview.binding.Pdbids[] array = new jalview.binding.Pdbids[0];
325 return (jalview.binding.Pdbids[]) this._pdbidsList.toArray(array);
329 * Method getPdbidsCount.
331 * @return the size of this collection
333 public int getPdbidsCount(
335 return this._pdbidsList.size();
339 * Returns the value of field 'start'.
341 * @return the value of field 'Start'.
351 * @return true if at least one Colour has been added
353 public boolean hasColour(
355 return this._has_colour;
361 * @return true if at least one End has been added
363 public boolean hasEnd(
365 return this._has_end;
371 * @return true if at least one Id has been added
373 public boolean hasId(
381 * @return true if at least one Start has been added
383 public boolean hasStart(
385 return this._has_start;
391 * @return true if this object is valid according to the schema
393 public boolean isValid(
397 } catch (org.exolab.castor.xml.ValidationException vex) {
407 * @throws org.exolab.castor.xml.MarshalException if object is
408 * null or if any SAXException is thrown during marshaling
409 * @throws org.exolab.castor.xml.ValidationException if this
410 * object is an invalid instance according to the schema
413 final java.io.Writer out)
414 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
415 Marshaller.marshal(this, out);
422 * @throws java.io.IOException if an IOException occurs during
424 * @throws org.exolab.castor.xml.ValidationException if this
425 * object is an invalid instance according to the schema
426 * @throws org.exolab.castor.xml.MarshalException if object is
427 * null or if any SAXException is thrown during marshaling
430 final org.xml.sax.ContentHandler handler)
431 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
432 Marshaller.marshal(this, handler);
437 public void removeAllFeatures(
439 this._featuresList.clear();
444 public void removeAllPdbids(
446 this._pdbidsList.clear();
450 * Method removeFeatures.
453 * @return true if the object was removed from the collection.
455 public boolean removeFeatures(
456 final jalview.binding.Features vFeatures) {
457 boolean removed = _featuresList.remove(vFeatures);
462 * Method removeFeaturesAt.
465 * @return the element removed from the collection
467 public jalview.binding.Features removeFeaturesAt(
469 java.lang.Object obj = this._featuresList.remove(index);
470 return (jalview.binding.Features) obj;
474 * Method removePdbids.
477 * @return true if the object was removed from the collection.
479 public boolean removePdbids(
480 final jalview.binding.Pdbids vPdbids) {
481 boolean removed = _pdbidsList.remove(vPdbids);
486 * Method removePdbidsAt.
489 * @return the element removed from the collection
491 public jalview.binding.Pdbids removePdbidsAt(
493 java.lang.Object obj = this._pdbidsList.remove(index);
494 return (jalview.binding.Pdbids) obj;
498 * Sets the value of field 'colour'.
500 * @param colour the value of field 'colour'.
502 public void setColour(
504 this._colour = colour;
505 this._has_colour = true;
509 * Sets the value of field 'end'.
511 * @param end the value of field 'end'.
516 this._has_end = true;
524 * @throws java.lang.IndexOutOfBoundsException if the index
525 * given is outside the bounds of the collection
527 public void setFeatures(
529 final jalview.binding.Features vFeatures)
530 throws java.lang.IndexOutOfBoundsException {
531 // check bounds for index
532 if (index < 0 || index >= this._featuresList.size()) {
533 throw new IndexOutOfBoundsException("setFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
536 this._featuresList.set(index, vFeatures);
542 * @param vFeaturesArray
544 public void setFeatures(
545 final jalview.binding.Features[] vFeaturesArray) {
547 _featuresList.clear();
549 for (int i = 0; i < vFeaturesArray.length; i++) {
550 this._featuresList.add(vFeaturesArray[i]);
555 * Sets the value of field 'id'.
557 * @param id the value of field 'id'.
570 * @throws java.lang.IndexOutOfBoundsException if the index
571 * given is outside the bounds of the collection
573 public void setPdbids(
575 final jalview.binding.Pdbids vPdbids)
576 throws java.lang.IndexOutOfBoundsException {
577 // check bounds for index
578 if (index < 0 || index >= this._pdbidsList.size()) {
579 throw new IndexOutOfBoundsException("setPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
582 this._pdbidsList.set(index, vPdbids);
588 * @param vPdbidsArray
590 public void setPdbids(
591 final jalview.binding.Pdbids[] vPdbidsArray) {
595 for (int i = 0; i < vPdbidsArray.length; i++) {
596 this._pdbidsList.add(vPdbidsArray[i]);
601 * Sets the value of field 'start'.
603 * @param start the value of field 'start'.
605 public void setStart(
608 this._has_start = true;
615 * @throws org.exolab.castor.xml.MarshalException if object is
616 * null or if any SAXException is thrown during marshaling
617 * @throws org.exolab.castor.xml.ValidationException if this
618 * object is an invalid instance according to the schema
619 * @return the unmarshaled jalview.binding.JSeq
621 public static jalview.binding.JSeq unmarshal(
622 final java.io.Reader reader)
623 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
624 return (jalview.binding.JSeq) Unmarshaller.unmarshal(jalview.binding.JSeq.class, reader);
630 * @throws org.exolab.castor.xml.ValidationException if this
631 * object is an invalid instance according to the schema
633 public void validate(
635 throws org.exolab.castor.xml.ValidationException {
636 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
637 validator.validate(this);