1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
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 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.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import org.exolab.castor.xml.Marshaller;
34 import org.exolab.castor.xml.Unmarshaller;
39 * @version $Revision$ $Date$
41 public class JSeq implements java.io.Serializable
44 // --------------------------/
45 // - Class/Member Variables -/
46 // --------------------------/
54 * keeps track of state for field: _colour
56 private boolean _has_colour;
64 * keeps track of state for field: _start
66 private boolean _has_start;
74 * keeps track of state for field: _end
76 private boolean _has_end;
81 private java.lang.String _id;
86 private boolean _hidden;
89 * keeps track of state for field: _hidden
91 private boolean _has_hidden;
94 * Field _featuresList.
96 private java.util.Vector _featuresList;
101 private java.util.Vector _pdbidsList;
104 * Field _hiddenSequencesList.
106 private java.util.Vector _hiddenSequencesList;
115 this._featuresList = new java.util.Vector();
116 this._pdbidsList = new java.util.Vector();
117 this._hiddenSequencesList = new java.util.Vector();
128 * @throws java.lang.IndexOutOfBoundsException
129 * if the index given is outside the bounds of the collection
131 public void addFeatures(
132 final jalview.schemabinding.version2.Features vFeatures)
133 throws java.lang.IndexOutOfBoundsException
135 this._featuresList.addElement(vFeatures);
143 * @throws java.lang.IndexOutOfBoundsException
144 * if the index given is outside the bounds of the collection
146 public void addFeatures(final int index,
147 final jalview.schemabinding.version2.Features vFeatures)
148 throws java.lang.IndexOutOfBoundsException
150 this._featuresList.add(index, vFeatures);
156 * @param vHiddenSequences
157 * @throws java.lang.IndexOutOfBoundsException
158 * if the index given is outside the bounds of the collection
160 public void addHiddenSequences(final int vHiddenSequences)
161 throws java.lang.IndexOutOfBoundsException
163 this._hiddenSequencesList.addElement(new java.lang.Integer(
171 * @param vHiddenSequences
172 * @throws java.lang.IndexOutOfBoundsException
173 * if the index given is outside the bounds of the collection
175 public void addHiddenSequences(final int index, final int vHiddenSequences)
176 throws java.lang.IndexOutOfBoundsException
178 this._hiddenSequencesList.add(index, new java.lang.Integer(
186 * @throws java.lang.IndexOutOfBoundsException
187 * if the index given is outside the bounds of the collection
189 public void addPdbids(final jalview.schemabinding.version2.Pdbids vPdbids)
190 throws java.lang.IndexOutOfBoundsException
192 this._pdbidsList.addElement(vPdbids);
200 * @throws java.lang.IndexOutOfBoundsException
201 * if the index given is outside the bounds of the collection
203 public void addPdbids(final int index,
204 final jalview.schemabinding.version2.Pdbids vPdbids)
205 throws java.lang.IndexOutOfBoundsException
207 this._pdbidsList.add(index, vPdbids);
212 public void deleteColour()
214 this._has_colour = false;
219 public void deleteEnd()
221 this._has_end = false;
226 public void deleteHidden()
228 this._has_hidden = false;
233 public void deleteStart()
235 this._has_start = false;
239 * Method enumerateFeatures.
241 * @return an Enumeration over all jalview.schemabinding.version2.Features
244 public java.util.Enumeration enumerateFeatures()
246 return this._featuresList.elements();
250 * Method enumerateHiddenSequences.
252 * @return an Enumeration over all int elements
254 public java.util.Enumeration enumerateHiddenSequences()
256 return this._hiddenSequencesList.elements();
260 * Method enumeratePdbids.
262 * @return an Enumeration over all jalview.schemabinding.version2.Pdbids
265 public java.util.Enumeration enumeratePdbids()
267 return this._pdbidsList.elements();
271 * Returns the value of field 'colour'.
273 * @return the value of field 'Colour'.
275 public int getColour()
281 * Returns the value of field 'end'.
283 * @return the value of field 'End'.
291 * Method getFeatures.
294 * @throws java.lang.IndexOutOfBoundsException
295 * if the index given is outside the bounds of the collection
296 * @return the value of the jalview.schemabinding.version2.Features at the
299 public jalview.schemabinding.version2.Features getFeatures(final int index)
300 throws java.lang.IndexOutOfBoundsException
302 // check bounds for index
303 if (index < 0 || index >= this._featuresList.size())
305 throw new IndexOutOfBoundsException("getFeatures: Index value '"
306 + index + "' not in range [0.."
307 + (this._featuresList.size() - 1) + "]");
310 return (jalview.schemabinding.version2.Features) _featuresList
315 * Method getFeatures.Returns the contents of the collection in an Array.
317 * Note: Just in case the collection contents are changing in another thread,
318 * we pass a 0-length Array of the correct type into the API call. This way we
319 * <i>know</i> that the Array returned is of exactly the correct length.
321 * @return this collection as an Array
323 public jalview.schemabinding.version2.Features[] getFeatures()
325 jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
326 return (jalview.schemabinding.version2.Features[]) this._featuresList
331 * Method getFeaturesCount.
333 * @return the size of this collection
335 public int getFeaturesCount()
337 return this._featuresList.size();
341 * Returns the value of field 'hidden'.
343 * @return the value of field 'Hidden'.
345 public boolean getHidden()
351 * Method getHiddenSequences.
354 * @throws java.lang.IndexOutOfBoundsException
355 * if the index given is outside the bounds of the collection
356 * @return the value of the int at the given index
358 public int getHiddenSequences(final int index)
359 throws java.lang.IndexOutOfBoundsException
361 // check bounds for index
362 if (index < 0 || index >= this._hiddenSequencesList.size())
364 throw new IndexOutOfBoundsException(
365 "getHiddenSequences: Index value '" + index
366 + "' not in range [0.."
367 + (this._hiddenSequencesList.size() - 1) + "]");
370 return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
374 * Method getHiddenSequences.Returns the contents of the collection in an
377 * @return this collection as an Array
379 public int[] getHiddenSequences()
381 int size = this._hiddenSequencesList.size();
382 int[] array = new int[size];
383 java.util.Iterator iter = _hiddenSequencesList.iterator();
384 for (int index = 0; index < size; index++)
386 array[index] = ((java.lang.Integer) iter.next()).intValue();
392 * Method getHiddenSequencesCount.
394 * @return the size of this collection
396 public int getHiddenSequencesCount()
398 return this._hiddenSequencesList.size();
402 * Returns the value of field 'id'.
404 * @return the value of field 'Id'.
406 public java.lang.String getId()
415 * @throws java.lang.IndexOutOfBoundsException
416 * if the index given is outside the bounds of the collection
417 * @return the value of the jalview.schemabinding.version2.Pdbids at the given
420 public jalview.schemabinding.version2.Pdbids getPdbids(final int index)
421 throws java.lang.IndexOutOfBoundsException
423 // check bounds for index
424 if (index < 0 || index >= this._pdbidsList.size())
426 throw new IndexOutOfBoundsException("getPdbids: Index value '"
427 + index + "' not in range [0.."
428 + (this._pdbidsList.size() - 1) + "]");
431 return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
435 * Method getPdbids.Returns the contents of the collection in an Array.
437 * Note: Just in case the collection contents are changing in another thread,
438 * we pass a 0-length Array of the correct type into the API call. This way we
439 * <i>know</i> that the Array returned is of exactly the correct length.
441 * @return this collection as an Array
443 public jalview.schemabinding.version2.Pdbids[] getPdbids()
445 jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
446 return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList
451 * Method getPdbidsCount.
453 * @return the size of this collection
455 public int getPdbidsCount()
457 return this._pdbidsList.size();
461 * Returns the value of field 'start'.
463 * @return the value of field 'Start'.
465 public int getStart()
473 * @return true if at least one Colour has been added
475 public boolean hasColour()
477 return this._has_colour;
483 * @return true if at least one End has been added
485 public boolean hasEnd()
487 return this._has_end;
493 * @return true if at least one Hidden has been added
495 public boolean hasHidden()
497 return this._has_hidden;
503 * @return true if at least one Start has been added
505 public boolean hasStart()
507 return this._has_start;
511 * Returns the value of field 'hidden'.
513 * @return the value of field 'Hidden'.
515 public boolean isHidden()
523 * @return true if this object is valid according to the schema
525 public boolean isValid()
530 } catch (org.exolab.castor.xml.ValidationException vex)
541 * @throws org.exolab.castor.xml.MarshalException
542 * if object is null or if any SAXException is thrown during
544 * @throws org.exolab.castor.xml.ValidationException
545 * if this object is an invalid instance according to the schema
547 public void marshal(final java.io.Writer out)
548 throws org.exolab.castor.xml.MarshalException,
549 org.exolab.castor.xml.ValidationException
551 Marshaller.marshal(this, out);
558 * @throws java.io.IOException
559 * if an IOException occurs during marshaling
560 * @throws org.exolab.castor.xml.ValidationException
561 * if this object is an invalid instance according to the schema
562 * @throws org.exolab.castor.xml.MarshalException
563 * if object is null or if any SAXException is thrown during
566 public void marshal(final org.xml.sax.ContentHandler handler)
567 throws java.io.IOException,
568 org.exolab.castor.xml.MarshalException,
569 org.exolab.castor.xml.ValidationException
571 Marshaller.marshal(this, handler);
576 public void removeAllFeatures()
578 this._featuresList.clear();
583 public void removeAllHiddenSequences()
585 this._hiddenSequencesList.clear();
590 public void removeAllPdbids()
592 this._pdbidsList.clear();
596 * Method removeFeatures.
599 * @return true if the object was removed from the collection.
601 public boolean removeFeatures(
602 final jalview.schemabinding.version2.Features vFeatures)
604 boolean removed = _featuresList.remove(vFeatures);
609 * Method removeFeaturesAt.
612 * @return the element removed from the collection
614 public jalview.schemabinding.version2.Features removeFeaturesAt(
617 java.lang.Object obj = this._featuresList.remove(index);
618 return (jalview.schemabinding.version2.Features) obj;
622 * Method removeHiddenSequences.
624 * @param vHiddenSequences
625 * @return true if the object was removed from the collection.
627 public boolean removeHiddenSequences(final int vHiddenSequences)
629 boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(
635 * Method removeHiddenSequencesAt.
638 * @return the element removed from the collection
640 public int removeHiddenSequencesAt(final int index)
642 java.lang.Object obj = this._hiddenSequencesList.remove(index);
643 return ((java.lang.Integer) obj).intValue();
647 * Method removePdbids.
650 * @return true if the object was removed from the collection.
652 public boolean removePdbids(
653 final jalview.schemabinding.version2.Pdbids vPdbids)
655 boolean removed = _pdbidsList.remove(vPdbids);
660 * Method removePdbidsAt.
663 * @return the element removed from the collection
665 public jalview.schemabinding.version2.Pdbids removePdbidsAt(
668 java.lang.Object obj = this._pdbidsList.remove(index);
669 return (jalview.schemabinding.version2.Pdbids) obj;
673 * Sets the value of field 'colour'.
676 * the value of field 'colour'.
678 public void setColour(final int colour)
680 this._colour = colour;
681 this._has_colour = true;
685 * Sets the value of field 'end'.
688 * the value of field 'end'.
690 public void setEnd(final int end)
693 this._has_end = true;
701 * @throws java.lang.IndexOutOfBoundsException
702 * if the index given is outside the bounds of the collection
704 public void setFeatures(final int index,
705 final jalview.schemabinding.version2.Features vFeatures)
706 throws java.lang.IndexOutOfBoundsException
708 // check bounds for index
709 if (index < 0 || index >= this._featuresList.size())
711 throw new IndexOutOfBoundsException("setFeatures: Index value '"
712 + index + "' not in range [0.."
713 + (this._featuresList.size() - 1) + "]");
716 this._featuresList.set(index, vFeatures);
722 * @param vFeaturesArray
724 public void setFeatures(
725 final jalview.schemabinding.version2.Features[] vFeaturesArray)
728 _featuresList.clear();
730 for (int i = 0; i < vFeaturesArray.length; i++)
732 this._featuresList.add(vFeaturesArray[i]);
737 * Sets the value of field 'hidden'.
740 * the value of field 'hidden'.
742 public void setHidden(final boolean hidden)
744 this._hidden = hidden;
745 this._has_hidden = true;
752 * @param vHiddenSequences
753 * @throws java.lang.IndexOutOfBoundsException
754 * if the index given is outside the bounds of the collection
756 public void setHiddenSequences(final int index, final int vHiddenSequences)
757 throws java.lang.IndexOutOfBoundsException
759 // check bounds for index
760 if (index < 0 || index >= this._hiddenSequencesList.size())
762 throw new IndexOutOfBoundsException(
763 "setHiddenSequences: Index value '" + index
764 + "' not in range [0.."
765 + (this._hiddenSequencesList.size() - 1) + "]");
768 this._hiddenSequencesList.set(index, new java.lang.Integer(
775 * @param vHiddenSequencesArray
777 public void setHiddenSequences(final int[] vHiddenSequencesArray)
780 _hiddenSequencesList.clear();
782 for (int i = 0; i < vHiddenSequencesArray.length; i++)
784 this._hiddenSequencesList.add(new java.lang.Integer(
785 vHiddenSequencesArray[i]));
790 * Sets the value of field 'id'.
793 * the value of field 'id'.
795 public void setId(final java.lang.String id)
805 * @throws java.lang.IndexOutOfBoundsException
806 * if the index given is outside the bounds of the collection
808 public void setPdbids(final int index,
809 final jalview.schemabinding.version2.Pdbids vPdbids)
810 throws java.lang.IndexOutOfBoundsException
812 // check bounds for index
813 if (index < 0 || index >= this._pdbidsList.size())
815 throw new IndexOutOfBoundsException("setPdbids: Index value '"
816 + index + "' not in range [0.."
817 + (this._pdbidsList.size() - 1) + "]");
820 this._pdbidsList.set(index, vPdbids);
826 * @param vPdbidsArray
828 public void setPdbids(
829 final jalview.schemabinding.version2.Pdbids[] vPdbidsArray)
834 for (int i = 0; i < vPdbidsArray.length; i++)
836 this._pdbidsList.add(vPdbidsArray[i]);
841 * Sets the value of field 'start'.
844 * the value of field 'start'.
846 public void setStart(final int start)
849 this._has_start = true;
856 * @throws org.exolab.castor.xml.MarshalException
857 * if object is null or if any SAXException is thrown during
859 * @throws org.exolab.castor.xml.ValidationException
860 * if this object is an invalid instance according to the schema
861 * @return the unmarshaled jalview.schemabinding.version2.JSeq
863 public static jalview.schemabinding.version2.JSeq unmarshal(
864 final java.io.Reader reader)
865 throws org.exolab.castor.xml.MarshalException,
866 org.exolab.castor.xml.ValidationException
868 return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(
869 jalview.schemabinding.version2.JSeq.class, reader);
875 * @throws org.exolab.castor.xml.ValidationException
876 * if this object is an invalid instance according to the schema
878 public void validate() throws org.exolab.castor.xml.ValidationException
880 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
881 validator.validate(this);