1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $(date) 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.
20 *******************************************************************************/
22 * This class was automatically generated with
23 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
28 package jalview.binding;
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
40 * @version $Revision$ $Date$
42 public class JSeq implements java.io.Serializable
45 // --------------------------/
46 // - Class/Member Variables -/
47 // --------------------------/
55 * keeps track of state for field: _colour
57 private boolean _has_colour;
65 * keeps track of state for field: _start
67 private boolean _has_start;
75 * keeps track of state for field: _end
77 private boolean _has_end;
85 * keeps track of state for field: _id
87 private boolean _has_id;
90 * Field _featuresList.
92 private java.util.Vector _featuresList;
97 private java.util.Vector _pdbidsList;
106 this._featuresList = new java.util.Vector();
107 this._pdbidsList = new java.util.Vector();
118 * @throws java.lang.IndexOutOfBoundsException
119 * if the index given is outside the bounds of the collection
121 public void addFeatures(final jalview.binding.Features vFeatures)
122 throws java.lang.IndexOutOfBoundsException
124 this._featuresList.addElement(vFeatures);
132 * @throws java.lang.IndexOutOfBoundsException
133 * if the index given is outside the bounds of the collection
135 public void addFeatures(final int index,
136 final jalview.binding.Features vFeatures)
137 throws java.lang.IndexOutOfBoundsException
139 this._featuresList.add(index, vFeatures);
146 * @throws java.lang.IndexOutOfBoundsException
147 * if the index given is outside the bounds of the collection
149 public void addPdbids(final jalview.binding.Pdbids vPdbids)
150 throws java.lang.IndexOutOfBoundsException
152 this._pdbidsList.addElement(vPdbids);
160 * @throws java.lang.IndexOutOfBoundsException
161 * if the index given is outside the bounds of the collection
163 public void addPdbids(final int index,
164 final jalview.binding.Pdbids vPdbids)
165 throws java.lang.IndexOutOfBoundsException
167 this._pdbidsList.add(index, vPdbids);
172 public void deleteColour()
174 this._has_colour = false;
179 public void deleteEnd()
181 this._has_end = false;
186 public void deleteId()
188 this._has_id = false;
193 public void deleteStart()
195 this._has_start = false;
199 * Method enumerateFeatures.
201 * @return an Enumeration over all jalview.binding.Features elements
203 public java.util.Enumeration enumerateFeatures()
205 return this._featuresList.elements();
209 * Method enumeratePdbids.
211 * @return an Enumeration over all jalview.binding.Pdbids elements
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
243 * if the index given is outside the bounds of the collection
244 * @return the value of the jalview.binding.Features at the given index
246 public jalview.binding.Features getFeatures(final int index)
247 throws java.lang.IndexOutOfBoundsException
249 // check bounds for index
250 if (index < 0 || index >= this._featuresList.size())
252 throw new IndexOutOfBoundsException(
253 "getFeatures: Index value '" + index + "' not in range [0.."
254 + (this._featuresList.size() - 1) + "]");
257 return (jalview.binding.Features) _featuresList.get(index);
261 * Method getFeatures.Returns the contents of the collection in an Array.
263 * Note: Just in case the collection contents are changing in another thread,
264 * we pass a 0-length Array of the correct type into the API call. This way we
265 * <i>know</i> that the Array returned is of exactly the correct length.
267 * @return this collection as an Array
269 public jalview.binding.Features[] getFeatures()
271 jalview.binding.Features[] array = new jalview.binding.Features[0];
272 return (jalview.binding.Features[]) this._featuresList.toArray(array);
276 * Method getFeaturesCount.
278 * @return the size of this collection
280 public int getFeaturesCount()
282 return this._featuresList.size();
286 * Returns the value of field 'id'.
288 * @return the value of field 'Id'.
299 * @throws java.lang.IndexOutOfBoundsException
300 * if the index given is outside the bounds of the collection
301 * @return the value of the jalview.binding.Pdbids at the given index
303 public jalview.binding.Pdbids getPdbids(final int index)
304 throws java.lang.IndexOutOfBoundsException
306 // check bounds for index
307 if (index < 0 || index >= this._pdbidsList.size())
309 throw new IndexOutOfBoundsException(
310 "getPdbids: Index value '" + index + "' not in range [0.."
311 + (this._pdbidsList.size() - 1) + "]");
314 return (jalview.binding.Pdbids) _pdbidsList.get(index);
318 * Method getPdbids.Returns the contents of the collection in an Array.
320 * Note: Just in case the collection contents are changing in another thread,
321 * we pass a 0-length Array of the correct type into the API call. This way we
322 * <i>know</i> that the Array returned is of exactly the correct length.
324 * @return this collection as an Array
326 public jalview.binding.Pdbids[] getPdbids()
328 jalview.binding.Pdbids[] array = new jalview.binding.Pdbids[0];
329 return (jalview.binding.Pdbids[]) this._pdbidsList.toArray(array);
333 * Method getPdbidsCount.
335 * @return the size of this collection
337 public int getPdbidsCount()
339 return this._pdbidsList.size();
343 * Returns the value of field 'start'.
345 * @return the value of field 'Start'.
347 public int getStart()
355 * @return true if at least one Colour has been added
357 public boolean hasColour()
359 return this._has_colour;
365 * @return true if at least one End has been added
367 public boolean hasEnd()
369 return this._has_end;
375 * @return true if at least one Id has been added
377 public boolean hasId()
385 * @return true if at least one Start has been added
387 public boolean hasStart()
389 return this._has_start;
395 * @return true if this object is valid according to the schema
397 public boolean isValid()
402 } catch (org.exolab.castor.xml.ValidationException vex)
413 * @throws org.exolab.castor.xml.MarshalException
414 * if object is null or if any SAXException is thrown during
416 * @throws org.exolab.castor.xml.ValidationException
417 * if this object is an invalid instance according to the schema
419 public void marshal(final java.io.Writer out)
420 throws org.exolab.castor.xml.MarshalException,
421 org.exolab.castor.xml.ValidationException
423 Marshaller.marshal(this, out);
430 * @throws java.io.IOException
431 * if an IOException occurs during marshaling
432 * @throws org.exolab.castor.xml.ValidationException
433 * if this object is an invalid instance according to the schema
434 * @throws org.exolab.castor.xml.MarshalException
435 * if object is null or if any SAXException is thrown during
438 public void marshal(final org.xml.sax.ContentHandler handler)
439 throws java.io.IOException,
440 org.exolab.castor.xml.MarshalException,
441 org.exolab.castor.xml.ValidationException
443 Marshaller.marshal(this, handler);
448 public void removeAllFeatures()
450 this._featuresList.clear();
455 public void removeAllPdbids()
457 this._pdbidsList.clear();
461 * Method removeFeatures.
464 * @return true if the object was removed from the collection.
466 public boolean removeFeatures(final jalview.binding.Features vFeatures)
468 boolean removed = _featuresList.remove(vFeatures);
473 * Method removeFeaturesAt.
476 * @return the element removed from the collection
478 public jalview.binding.Features removeFeaturesAt(final int index)
480 java.lang.Object obj = this._featuresList.remove(index);
481 return (jalview.binding.Features) obj;
485 * Method removePdbids.
488 * @return true if the object was removed from the collection.
490 public boolean removePdbids(final jalview.binding.Pdbids vPdbids)
492 boolean removed = _pdbidsList.remove(vPdbids);
497 * Method removePdbidsAt.
500 * @return the element removed from the collection
502 public jalview.binding.Pdbids removePdbidsAt(final int index)
504 java.lang.Object obj = this._pdbidsList.remove(index);
505 return (jalview.binding.Pdbids) obj;
509 * Sets the value of field 'colour'.
512 * the value of field 'colour'.
514 public void setColour(final int colour)
516 this._colour = colour;
517 this._has_colour = true;
521 * Sets the value of field 'end'.
524 * the value of field 'end'.
526 public void setEnd(final int end)
529 this._has_end = true;
537 * @throws java.lang.IndexOutOfBoundsException
538 * if the index given is outside the bounds of the collection
540 public void setFeatures(final int index,
541 final jalview.binding.Features vFeatures)
542 throws java.lang.IndexOutOfBoundsException
544 // check bounds for index
545 if (index < 0 || index >= this._featuresList.size())
547 throw new IndexOutOfBoundsException(
548 "setFeatures: Index value '" + index + "' not in range [0.."
549 + (this._featuresList.size() - 1) + "]");
552 this._featuresList.set(index, vFeatures);
558 * @param vFeaturesArray
560 public void setFeatures(final jalview.binding.Features[] vFeaturesArray)
563 _featuresList.clear();
565 for (int i = 0; i < vFeaturesArray.length; i++)
567 this._featuresList.add(vFeaturesArray[i]);
572 * Sets the value of field 'id'.
575 * the value of field 'id'.
577 public void setId(final int id)
588 * @throws java.lang.IndexOutOfBoundsException
589 * if the index given is outside the bounds of the collection
591 public void setPdbids(final int index,
592 final jalview.binding.Pdbids vPdbids)
593 throws java.lang.IndexOutOfBoundsException
595 // check bounds for index
596 if (index < 0 || index >= this._pdbidsList.size())
598 throw new IndexOutOfBoundsException(
599 "setPdbids: Index value '" + index + "' not in range [0.."
600 + (this._pdbidsList.size() - 1) + "]");
603 this._pdbidsList.set(index, vPdbids);
609 * @param vPdbidsArray
611 public void setPdbids(final jalview.binding.Pdbids[] vPdbidsArray)
616 for (int i = 0; i < vPdbidsArray.length; i++)
618 this._pdbidsList.add(vPdbidsArray[i]);
623 * Sets the value of field 'start'.
626 * the value of field 'start'.
628 public void setStart(final int start)
631 this._has_start = true;
638 * @throws org.exolab.castor.xml.MarshalException
639 * if object is null or if any SAXException is thrown during
641 * @throws org.exolab.castor.xml.ValidationException
642 * if this object is an invalid instance according to the schema
643 * @return the unmarshaled jalview.binding.JSeq
645 public static jalview.binding.JSeq unmarshal(final java.io.Reader reader)
646 throws org.exolab.castor.xml.MarshalException,
647 org.exolab.castor.xml.ValidationException
649 return (jalview.binding.JSeq) Unmarshaller
650 .unmarshal(jalview.binding.JSeq.class, reader);
656 * @throws org.exolab.castor.xml.ValidationException
657 * if this object is an invalid instance according to the schema
659 public void validate() throws org.exolab.castor.xml.ValidationException
661 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
662 validator.validate(this);